从Boost中提取sublib尽可能小 [英] extract sublib from Boost as small as possible

查看:113
本文介绍了从Boost中提取sublib尽可能小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Boost是一个很棒的库,但有时,添加整个库是不方便的。所以我想提取Boost的一小部分,只提取必要的文件。



我知道BCP.exe,但它没有按预期工作。 BCP.exe提取了太多不必要的文件。



我使用Visual C ++ 2010,所以我不需要Mac或Linux文件。只支持Visual C ++编译器就行了。



有人可以帮帮我吗?例如,我只想使用Boost :: any,但是bcp提取以下文件列表:

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\auto_link.hpp
\boost\config\compiler
\boost\config\no_tr1
\boost\config\platform
\boost\config\posix_features.hpp
\boost\config\requires_threads.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_\adl_barrier.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\adl.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\overload_resolution.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\variadic
\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\facilities\overload.hpp
\boost\preprocessor\list\adt.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\preprocessor\variadic\elem.hpp
\boost\preprocessor\variadic\size.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

推荐答案

无法建议您可以删除的内容,因为所有组件都倾向于互联。诸如boost之类的库是随着时间的推移而开发的,并且组件被添加和更新。删除任何单个文件可能意味着您的程序将无法构建。而且由于现在磁盘空间不是很重要,所以没有必要担心它。
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.


我知道你来自哪里,因为我遇到了与Boost相同的问题库代码自己。我想使用很酷的想法X,但我不想负责在源代码树中添加2000个依赖项并每隔几周更新一次,更不用说修复由于代码而导致破坏的任何内容,我几乎无法理解。我不能说我已经解决了这个问题,但在你的特殊情况下使用Boost ::任何我都会建议以下内容。

制作一份any.hpp的副本并包含它。

注释副本中的所有增强/包含。

对使用它的源进行试验编译。

它显然不起作用,但会给你一个坏的清单。

通过你的any.hpp副本处理你不需要的东西,GCC支持,检查旧的破碎的模板实现,可疑的强制转换,断言你可以没有。

每次你改变一些东西做另一个构建,以确保坏事列表不再是以前。

几分钟后你将有两件事:

一个工作或非常接近工作的Boost ::任何完全从Boost中提取的版本。

很多更好地理解Boost :: any,它是如何工作的以及它的作用。

有了这两件事,你很可能能够用你的自定义任意一个解决原始用例基于您对它的理解,使用另一种解决方案。

请记住,如果您自定义,则不要使用Boost命名空间,将其替换为您自己的命名空间,以防有人决定在项目中包含Boost标头跟你的 代码之后,你不想要名字冲突。

祝你好运。
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.


这篇关于从Boost中提取sublib尽可能小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆