views:

1788

answers:

6
+17  Q: 

How to learn boost

I've heard so many comments in SO and other places about boost libraries that I finally decided to learn them. Can anyone recommend me some tutorial or online book?

+3  A: 

Just try the boost homepage itself. The documentation is pretty good to get started, and if you need more help, you can ask on the mailing lists. There is nothing to learn about them, you just hit a problem, take a look at Boost whether they have a solution, and try it. For this, the documentation is surely enough. If you need further help, books won't be up-to-date enough anyway.

Using boost quite some time now, and never needed an additional book for it.

Anteru
+3  A: 

Usually I try the documentation of the provider first:

Boost: Getting Started
Boost: Libraries

Another nice overview (which links to subsections inside the above libraries):

Wikibooks: C++ Programming/Compiler/Linker/Libraries/Boost

TomWij
+8  A: 

I found Beyond The C++ Standard Library a great place to start. It discusses some of the more commonly used boost libraries in great detail. The documentation on the boost web site has been a bit spartan, but is getting better.

There are also books for Boost.MPL and Boost.Graph.

BTW, None of these books are online as far as I know.

Ferruccio
+1  A: 

I've always felt that the Boost documentation itself was great - no need for a separate tutorial. The best way to get started is to download the libraries and write some code to play with it. Try out shared_ptr and the smart pointer containers to start. If you have any questions, there are lots of knowledgeable people here on SO.

Kristo
+17  A: 

My best suggestion is don't try to learn Boost. Look at the index page and the list of libraries, and scan the description of each, and then learn the specific libraries you think could be helpful. Treat it as a collection of independent libraries, to be learned individually, rather than one master library to be learned "all or nothing". The boost documentation varies a lot, and for some libraries, it is really straightforward, while for others, it only seems to document how to use the library assuming you already know how it works.

But a lot of it is really just getting used to "Modern C++" style code. Boost mimics the STL and other examples of modern C++ heavily, so make sure you get familiar with template metaprogramming, RAII and functors and all those clever tricks.

jalf
+4  A: 

Agree with the others here - the Boost documentation is generally very good. However recently-added libraries tend to be a lot more extensively documented (the documentation for Bimap is just fantastic, for instance).

But don't forget most libraries have example code which is generally a great place to start when learning Boost (either as a whole or individual libraries). Look in the libs/*/example directories.

Set yourself up with a "sandbox" project where you can play with the code and try it out.

As others have suggested too, some libraries are better tackled earlier than others. For example, leave the MPL stuff until you've got a grasp on some of the more fundamental libraries.

Personally, I'd start with the TR1 libraries - especially Smart Pointer, Regex, Function, and Bind.

Alastair
@Alastair: +1 for encouraging going through headers and example directories
Chubsdad