views:

192

answers:

3

Possible Duplicate:
Code reading: where can I read great, modern, and well-documented C++ code?

Is there an open source project written in C++ that you would in particular recommend for learning purposes? Something I could study and get ideas from about how correct structuring and code design in C++.

+2  A: 

I think ACE is a good example of a mature open-source multi-platform C++ library with a lot of available documentation. A lot of the documentation is in the form of academic papers, so you learn a lot about the underlying algorithms, design patterns, and tradeoffs.

However, note that it originated some time ago, and suffers from some ugliness in order to be compatible with all the C++ compilers it has ever supported.

Kristopher Johnson
+1 - the patterns are seminal
Steve Townsend
+1  A: 

You might look at the wxWidgets source. It's massive, functional, and reasonably well-organized. In addition to downloading the source, you can view it online here:

http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/

Reinderien
+5  A: 

Boost - which is so great that a lot of it is winding up in the standard.

Superb for advanced and portable techniques like expression templates in boost::ublas, threading in boost::thread, async I/O in boost::asio as well as the well-known stuff like smart pointers. All the latest techniques like template metaprogramming are on display, implemented and exhaustively reviewed before release, by the best in the field.

The thing I like especially about this one is that you can improve your own code as you learn, by incorporating the libraries as appropriate. It's hard to overstate the productivity gain you get by building on such libraries.

You could also consider your compiler's STL implementation as a source of inspiration, though that's not strictly open-source.

Steve Townsend
I've been tempted to read-up Boost code... but you might wish to equip yourself with potholing equipment and prepare a few hours for just a few features. It's full of compiler work-arounds and split up in multiple (many many) header files to remain manageable... and thus it's quite difficult to follow.
Matthieu M.