How to include only BOOST smart pointer codes into a project?

泪湿孤枕 提交于 2019-12-07 07:58:26

问题


What are best practices to include boost smart pointer library only without adding all boost libraries into the project?

I only want boost smart pointer library in my project and I don't want to check in/commit 200 MB source codes (boost 1.42.0) into my project repository just for that. What more, my windows mobile project itself doesn't even reach 10% of that size!


回答1:


For just the smart pointer library, you have two options.

  1. Copy the headers you include in your source files (shared_ptr.hpp, etc.). Then copy over additional files until the project builds (make sure to maintain the directory structure).
  2. Use the boost bcp utility. For larger subsets, this tool saves a ton of time.

The former will make sure the fewest number of files possible gets added your project. The latter is much faster for any substantial subset of boost, but it will likely include many files you don't need (compatibility headers for platforms your program doesn't support).




回答2:


Just check in the folder containing the code you want? Try deleting/moving/renaming "everything else" and see what external dependencies the smart pointer library has, probably not many. I'm almost positive it doesn't require any built code (i.e. libraries), so just checking in all of the headers that get included seems like the way to go.



来源:https://stackoverflow.com/questions/2512823/how-to-include-only-boost-smart-pointer-codes-into-a-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!