12,754,455 members (29,071 online)
Rate this:
See more:
Boost is an excellent library, but sometimes, it's inconvenient to add the whole library. So I want to extract a little part of Boost, only the necessary files are extracted.

I know BCP.exe, but it didn't work as expected. BCP.exe extract too many unnecessary files.

I work with Visual C++ 2010, so I don't need the Mac or Linux files. Only support for Visual C++ compiler is OK.

Anybody can help me? For example, I just want to use Boost::any, but bcp extract the following file list:
\boost\any.hpp
\boost\config
\boost\config.hpp
\boost\current_function.hpp
\boost\detail
\boost\exception
\boost\mpl
\boost\non_type.hpp
\boost\preprocessor
\boost\static_assert.hpp
\boost\throw_exception.hpp
\boost\type.hpp
\boost\type_traits
\boost\version.hpp
\boost\config\abi
\boost\config\abi_prefix.hpp
\boost\config\abi_suffix.hpp
\boost\config\compiler
\boost\config\no_tr1
\boost\config\platform
\boost\config\posix_features.hpp
\boost\config\select_compiler_config.hpp
\boost\config\select_platform_config.hpp
\boost\config\select_stdlib_config.hpp
\boost\config\stdlib
\boost\config\suffix.hpp
\boost\config\user.hpp
\boost\config\warning_disable.hpp
\boost\config\abi\borland_prefix.hpp
\boost\config\abi\borland_suffix.hpp
\boost\config\abi\msvc_prefix.hpp
\boost\config\abi\msvc_suffix.hpp
\boost\config\compiler\borland.hpp
\boost\config\compiler\clang.hpp
\boost\config\compiler\codegear.hpp
\boost\config\compiler\comeau.hpp
\boost\config\compiler\common_edg.hpp
\boost\config\compiler\compaq_cxx.hpp
\boost\config\compiler\cray.hpp
\boost\config\compiler\digitalmars.hpp
\boost\config\compiler\gcc.hpp
\boost\config\compiler\gcc_xml.hpp
\boost\config\compiler\greenhills.hpp
\boost\config\compiler\hp_acc.hpp
\boost\config\compiler\intel.hpp
\boost\config\compiler\kai.hpp
\boost\config\compiler\metrowerks.hpp
\boost\config\compiler\mpw.hpp
\boost\config\compiler\nvcc.hpp
\boost\config\compiler\pathscale.hpp
\boost\config\compiler\pgi.hpp
\boost\config\compiler\sgi_mipspro.hpp
\boost\config\compiler\sunpro_cc.hpp
\boost\config\compiler\vacpp.hpp
\boost\config\compiler\visualc.hpp
\boost\config\no_tr1\cmath.hpp
\boost\config\no_tr1\complex.hpp
\boost\config\no_tr1\functional.hpp
\boost\config\no_tr1\memory.hpp
\boost\config\no_tr1\utility.hpp
\boost\config\platform\aix.hpp
\boost\config\platform\amigaos.hpp
\boost\config\platform\beos.hpp
\boost\config\platform\bsd.hpp
\boost\config\platform\cray.hpp
\boost\config\platform\cygwin.hpp
\boost\config\platform\hpux.hpp
\boost\config\platform\irix.hpp
\boost\config\platform\linux.hpp
\boost\config\platform\macos.hpp
\boost\config\platform\qnxnto.hpp
\boost\config\platform\solaris.hpp
\boost\config\platform\symbian.hpp
\boost\config\platform\vms.hpp
\boost\config\platform\vxworks.hpp
\boost\config\platform\win32.hpp
\boost\config\stdlib\dinkumware.hpp
\boost\config\stdlib\libcomo.hpp
\boost\config\stdlib\libcpp.hpp
\boost\config\stdlib\libstdcpp3.hpp
\boost\config\stdlib\modena.hpp
\boost\config\stdlib\msl.hpp
\boost\config\stdlib\roguewave.hpp
\boost\config\stdlib\sgi.hpp
\boost\config\stdlib\stlport.hpp
\boost\config\stdlib\vacpp.hpp
\boost\detail\workaround.hpp
\boost\exception\detail
\boost\exception\exception.hpp
\boost\exception\detail\attribute_noreturn.hpp
\boost\mpl\aux_
\boost\mpl\bool.hpp
\boost\mpl\bool_fwd.hpp
\boost\mpl\int.hpp
\boost\mpl\integral_c.hpp
\boost\mpl\integral_c_fwd.hpp
\boost\mpl\integral_c_tag.hpp
\boost\mpl\int_fwd.hpp
\boost\mpl\aux_\config
\boost\mpl\aux_\integral_wrapper.hpp
\boost\mpl\aux_\lambda_support.hpp
\boost\mpl\aux_\na_fwd.hpp
\boost\mpl\aux_\nttp_decl.hpp
\boost\mpl\aux_\preprocessor
\boost\mpl\aux_\static_cast.hpp
\boost\mpl\aux_\template_arity_fwd.hpp
\boost\mpl\aux_\yes_no.hpp
\boost\mpl\aux_\config\arrays.hpp
\boost\mpl\aux_\config\ctps.hpp
\boost\mpl\aux_\config\gcc.hpp
\boost\mpl\aux_\config\intel.hpp
\boost\mpl\aux_\config\lambda.hpp
\boost\mpl\aux_\config\msvc.hpp
\boost\mpl\aux_\config\nttp.hpp
\boost\mpl\aux_\config\preprocessor.hpp
\boost\mpl\aux_\config\static_constant.hpp
\boost\mpl\aux_\config\ttp.hpp
\boost\mpl\aux_\config\workaround.hpp
\boost\mpl\aux_\preprocessor\enum.hpp
\boost\mpl\aux_\preprocessor\params.hpp
\boost\preprocessor\arithmetic
\boost\preprocessor\cat.hpp
\boost\preprocessor\comma_if.hpp
\boost\preprocessor\config
\boost\preprocessor\control
\boost\preprocessor\debug
\boost\preprocessor\detail
\boost\preprocessor\facilities
\boost\preprocessor\inc.hpp
\boost\preprocessor\list
\boost\preprocessor\logical
\boost\preprocessor\punctuation
\boost\preprocessor\repeat.hpp
\boost\preprocessor\repetition
\boost\preprocessor\tuple
\boost\preprocessor\arithmetic\inc.hpp
\boost\preprocessor\config\config.hpp
\boost\preprocessor\control\expr_iif.hpp
\boost\preprocessor\control\if.hpp
\boost\preprocessor\control\iif.hpp
\boost\preprocessor\debug\error.hpp
\boost\preprocessor\detail\auto_rec.hpp
\boost\preprocessor\detail\check.hpp
\boost\preprocessor\detail\dmc
\boost\preprocessor\detail\is_binary.hpp
\boost\preprocessor\detail\dmc\auto_rec.hpp
\boost\preprocessor\facilities\empty.hpp
\boost\preprocessor\list\for_each_i.hpp
\boost\preprocessor\logical\bool.hpp
\boost\preprocessor\logical\compl.hpp
\boost\preprocessor\punctuation\comma.hpp
\boost\preprocessor\punctuation\comma_if.hpp
\boost\preprocessor\repetition\detail
\boost\preprocessor\repetition\for.hpp
\boost\preprocessor\repetition\repeat.hpp
\boost\preprocessor\repetition\detail\dmc
\boost\preprocessor\repetition\detail\edg
\boost\preprocessor\repetition\detail\for.hpp
\boost\preprocessor\repetition\detail\msvc
\boost\preprocessor\repetition\detail\dmc\for.hpp
\boost\preprocessor\repetition\detail\edg\for.hpp
\boost\preprocessor\repetition\detail\msvc\for.hpp
\boost\preprocessor\tuple\eat.hpp
\boost\preprocessor\tuple\elem.hpp
\boost\preprocessor\tuple\rem.hpp
\boost\preprocessor\tuple\to_list.hpp
\boost\type_traits\broken_compiler_spec.hpp
\boost\type_traits\config.hpp
\boost\type_traits\detail
\boost\type_traits\ice.hpp
\boost\type_traits\integral_constant.hpp
\boost\type_traits\is_lvalue_reference.hpp
\boost\type_traits\is_reference.hpp
\boost\type_traits\is_rvalue_reference.hpp
\boost\type_traits\msvc
\boost\type_traits\remove_reference.hpp
\boost\type_traits\detail\bool_trait_def.hpp
\boost\type_traits\detail\bool_trait_undef.hpp
\boost\type_traits\detail\ice_and.hpp
\boost\type_traits\detail\ice_eq.hpp
\boost\type_traits\detail\ice_not.hpp
\boost\type_traits\detail\ice_or.hpp
\boost\type_traits\detail\template_arity_spec.hpp
\boost\type_traits\detail\type_trait_def.hpp
\boost\type_traits\detail\type_trait_undef.hpp
\boost\type_traits\detail\wrap.hpp
\boost\type_traits\detail\yes_no_type.hpp
\boost\type_traits\msvc\remove_reference.hpp
\boost\type_traits\msvc\typeof.hpp
Posted 3-Feb-13 1:26am

Rate this:

## Solution 2

I know where you're coming from because I've faced the same issue with Boost library code myself. I want to use cool idea X but I don't want to be responsible for adding 2000 dependencies to the source tree and updating them every few weeks let alone fixing anything that breaks as a result of code I can hardly read let alone understand. I can't say I have solved the problem but in your particular case with Boost::any I would suggest the following.
Make a copy of any.hpp and include just that.
Comment out all the boost/ inclusions from within your copy.
Do a trial compile of your source that uses it.
It will obviously not work but will give you a list of bad things.
Work through your copy of any.hpp removing stuff you don't need, GCC support, checks for old broken template implementations, hincky casts, assertions you can live without.
Each time you change something do another build to make sure the list of bad things is no longer than before.
In a few minutes you will have 2 things:
A working or very near working version of Boost::any completely extracted from Boost.
A much better understanding of Boost::any, how it works and what it does.
Armed with these 2 things you're highly likely to be able to resolve the original use case either with your custom any or with another solution based on your understanding of it.
Remember if you customize then don't use the Boost namespace, replace it with one of your own in case someone decides to include Boost headers in a project with your code later, you don't want a name clash.
Good luck.
Rate this:

## Solution 1

It is impossible to suggest what you can remove as all components tend to be interconnected. Libraries such as boost are developed over time and components are added and updated. Removing any single file could mean that your program will not build. And since disk space is not at a premium these days there is no point worrying about it.

Top Experts
Last 24hrsThis month
 Graeme_Grant 255 ppolymorphe 181 Maciej Los 170 Peter Leow 160 Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ) 150
 OriginalGriff 3,971 Peter Leow 3,051 Karthik Bangalore 2,375 ppolymorphe 2,373 Richard MacCutchan 1,594