tags:

views:

995

answers:

5
+2  Q: 

boost source code

Is there any way to get the boost libraries source code? I have browsed the SVN repository and I could see only HPP files. No source files are available there. I would like to look into the source code for "shared_ptr". Can anyone guide me?

Also from where can I download BCP utility?

+18  A: 

The vast majority of the source code is entirely in the header files - it has to be in order for templates to work. You cannot put template code in source files and compile them separately.

Adam Rosenfield
I have read from Bruce Eckel (Thinking in C++) that, putting all code in header files is less performant and it is a bad practice. But since boost is using it, I am confused. Is it an accepted practice?
Appu
Boost has to do this due to their extensive use of templates. It does increase compile time (sometimes significantly) but there is no real way around it. It also makes it easier to start using boost, since there are no libraries to distribute with your application.
Eclipse
As I recall, the code is all in templates, which has no concrete implementation until the template is expanded in your client code. The code is the instantiated template, not the "header."
JasonTrue
In order to get templates to work, you usually have to put all of the code in the headers. For a more thorough explanation, see the C++ FAQ: http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
Colin
This is not true. MOST of the code is in the header files. Some has to be compiled first.
Tim Matthews
+3  A: 

As Adam mentioned, it's almost all in the headers. Some, like boost::regex, do require source files to be built, but those are also included in the main download.

The BCP utility is included in the main download.

Eclipse
A: 

The Boost libraries have the following core directory structure:

-> boost : Contains the header files. Since much of Boost is implemented in headers, this also contains lots of implementation, usually in detail subdirectories.

-> lib : Contains the precompiled sources, test suites, examples, and sometimes documentation of the libraries.

-> doc : Contains some documentation.

-> tools : Contains the tools like Boost.Jam, Boost.Build, standalone Wave, and also BCP.

Sebastian Redl
+1  A: 

Most part of boost is in headers, but some parts are in cpp-files too. The doc index page lists which libraries are header/not header only. You can download the boost source here. The source of bcp is available in the archive too, in the tools/bcp subdirectory.

Johannes Schaub - litb
+2  A: 

All source files (.cpp) are under under /boost/libs/<library-name>

The majority of boost libraries consist entirely of headers. The exceptions are:

  • test
  • thread
  • wave
  • serialization
  • signals
  • python
  • regex
  • math
  • graph
  • iostreams
  • filesystem
  • datetime
Joe Gauterin