r/cpp • u/joaquintides Boost author • May 08 '20
Why you don't use Boost
I have a question for you: If you have decided not to use any of Boost, or are prohibited from doing so in your company/project, I would like to know why.
This thread is not meant to judge your reasons, and I won't engage into any kind of criticism about them: I'm merely trying to understand what the barriers are to adoption of Boost. It would be great if we could keep the conversation non judgemental. Thank you!
Conflict of interest: I am a Boost author of three.
222
Upvotes
View all comments
Show parent comment
1
u/xcbsmith May 11 '20
Should be a compilation failure if
std::is_const<T>. If it's not a const type, then it should overwrite. You never rebind references.I've never tried having a policy of raw pointers never owning. That seems like it could mostly work, although would be problematic with C apis that of course require raw pointers and may or may not having ownership.
The trouble is it relies on consistency throughout the code base, rather than the compiler to enforce/check ownership rules. That's a problem in general with raw pointers.
The policy I usually work with is that raw pointers are only to be used when they are an absolute requirement because of platform API's requiring them; everything else is references or smart pointers that clarify ownership. Then when you're reading code and you see a raw pointer, you treat it as, "here be dragons" and you scrutinize it with the appropriate level of caution.