Question

I have to use a smart pointer and I found "shared_ptr" from boost looks good. I downloaded the boost library and I can see many files and libraries there. Is there any way to use only the shared_ptr ?

Was it helpful?

Solution

boost bcp is your friend. It allows extracting individual boost libraries out of its tree. I used it with success in the past. shared_ptr consists only of headers, so that will be especially good for you.

OTHER TIPS

You can use bcp as litb suggested, but if you're worried about dragging in extra library code, you shouldn't be. Boost, in general, follows the C++ philosophy of "you only pay for what you use". So, if you include only the shared_ptr headers, that's all that your code will use.

If you're using a recent version of Visual C++ on Windows, BoostPro provides a convenient free installer here: http://www.boostpro.com/products/free.

Otherwise, or if you have already downloaded the source distribution, you should in fact be able to start using shared_ptr and friends right away as the shared_ptr library is "header-only" -- no compilation of .cpp files is required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top