tags:

views:

284

answers:

3

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 ?

+12  A: 

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.

Johannes Schaub - litb
+2  A: 

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.

j_random_hacker
+5  A: 

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.

Ferruccio