Fog Creek Software
Discussion Board




Good Documentation of C++ Standard Library

I'm a programmer making a transition from Java to C++. I really like the power that I have with C++ to do low-level system stuff. And I really appreciate the ability to work with pointers and references. I'm not having any trouble with these concepts. In fact, they have come to me quite easily.

What drives me bananas is that the entire c++ standard library is composed of obscure abbreviations and bizarre uses of operator overloading. Consequently, it's very hard for me to read c++ code. I'm used to Java's standard libraries, and I would much rather refer to a "FileOutputStream" than to a "ofstream".

So, what I'm looking for is some really good documentation (preferable in HTML format) that gives all of the details of the standard library. Ideally, it should have the names of classes, the header files that need to be included for those classes, the names of classes that the class inherits from, all properties in the class (or inherited from and other class), and the prototypes of all functions in this class (or inherited from other classes).

In short, what I'm looking for is a JavaDoc for the c++ stdlib. I've spent a few hours googling around looking for something, but without much luck. The closest thing I've found is a set of documents from dinkumware ( http://www.dinkumware.com ). These are reproduced in the msdn vc++ documentation at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/HTML/stdlbhm.asp .

This set of documents shows all of the header files and lists a few details about implementation, but they assume quite a bit of existing knowledge. For example, the page for "cin" lists only the following information:

The object controls extractions from the standard input as a byte stream. Once the object is constructed, the call cin.tie() returns &cout.

Which doesn't tell you much about _how_ to use a cin object. It doesn't tell you anything about the overloaded >> operator. And it doesn't say anything about using stream manipulators. All in all, it's not very useful.

Does anybody have any recommendations for a good set of stlib documents? (I'm even willing to buy a physical book if it comes with the electronic reference I'm looking for).

Benji Smith
Monday, July 01, 2002

C++ streams?  Argghhh!!!

I've picked up most of my streams knowledge from a hodgepodge of places.  I think I remember Eckel's book & the gnu docs as being good sources for the basics.  I find myself using good old FILE*'s more & more these days, although I love the stringstreams and formatting operators.

For STL though, the SGI site wins hands-down.

those who know me have no need of my name
Monday, July 01, 2002

Just give in and pickup the classic:
STL Tutorial and Reference Guide
by
David R. Musser, Atul Saini
Addison-Wesley.

[Does anybody have any recommendations for a good set of stlib documents? (I'm even willing to buy a physical book if it comes with the electronic reference I'm looking for).
]

Larry From Queens
Monday, July 01, 2002

Oh additionally, you might want to take an "Advanced C++" class at your local public university.[advanced usage of templates, operator overloading etc...].  It will take the misery out of all that stuff!!

Enjoy

Larry From Queens
Monday, July 01, 2002

Specifically related to iostreams, the "C++ IOStreams Handbook" by Steve Teale is the most comprehensive text on the subject.  It not only tells you how to use iostreams but whay lies underneath.  Its nicely written so that you don't have to understand the "why" just to get to "how".

FWIW,

Nat Ersoz
Monday, July 01, 2002

The Teale book is, unfortunately, obsolete, and has been for years.

There's a new C++ iostreams book out by some of the columnists from the old C++ Report, but it's rather a tough read.

I would suggest that you break down and buy a copy of _The C++ Programming Language, 3rd Edition_ by Stroustrup. It won't give you the reference information you're looking for, but it WILL give you the background to understand how to read the reference info you've already got.

In addition, you'll gain a much greater understanding of why C++ is the way it is.

Chris Tavares
Monday, July 01, 2002

Bad Idea!

It's treatment of the subject matter in question is much too light.

It's a good book, but in as far as STL / iostreams go, skip Stroustrup.

[I would suggest that you break down and buy a copy of _The C++ Programming Language, 3rd Edition_ by Stroustrup. It won't give you the reference information you're looking for, but it WILL give you the background to understand how to read the reference info you've already got.]

Larry From Queens
Monday, July 01, 2002

Light??? It's got like 300 pages on the design and usage of the standard library! Plus discussions of design decisions, tradeoffs, and how you'd write such things yourself.

Light compared to what?

If you're talking about iostreams, maybe I can agree with you. But the original poster wanted the basic background - what's a cin? Stroustrup gives that to you, and gives you the background to learn more.

Chris Tavares
Monday, July 01, 2002

Chris Buddy,
The orginal poster seemed fairly advanced.
So why dick around with light reading?

Hey look, Strou's book is excellent! it's on my shelf as we speak. But it's still very light as it pertains to both iostreams and STL.  [some people just like full coverage!!]
->NEXT

[If you're talking about iostreams, maybe I can agree with you. But the original poster wanted the basic background - what's a cin? Stroustrup gives that to you, and gives you the background to learn more.
]

Larry From Queens
Monday, July 01, 2002

And Yeah it's definitely light with respect to STL.
Get the book previously mentioned[400pages of pure STL reference]

Larry From Queens
Monday, July 01, 2002

Chris,

Is the Teale book really that obsolete?  From what I can tell, some headers changed: <iostream.h> ==> <iostream> and uses namepsace std....  But are there substantive differences?  Apparently I am obsolete also, because I haven't changed my usage in the last 10 years...  (of course, I'm using glibc, which seems to be significantly behind also).

Nat Ersoz
Monday, July 01, 2002

Well, the istream class doesn't exist anymore, for one thing - istream (and ostream, and fstream, etc.) are all typedefs for basic_stream, which is templated.

strstream is gone - replaced with the much more reliable stringstream.

Everything's been turned into templates templated on character types.

There's a whole boatload of internationalization stuff that's been added.

streambuf's have grown a new method, so if you're getting into advanced usage Teale's book won't help you.

The very basic usages haven't changed, but there's a lot of gotchas that have.

Chris Tavares
Monday, July 01, 2002

Just to clarify after seeing some of these replies to my original message...

Yes, I know what a cin object is. I was just using that as a basic example of what I'm looking for and why the documentation I'm finding doesn't fit the bill.

To get the idea of _exactly_ what I'm looking for, take a look at Sun's excellent documentation of the core Java API ( http://java.sun.com/j2se/1.3/docs/api/ ).

...Or look at the excellent PHP manual ( http://www.php.net/manual/en/ )

...or the equally excellent mySQL manual ( http://www.mysql.com/documentation/mysql/bychapter/ ).

I'm looking for some excellent documentation that breaks down the stdlib, class by class and function by function, and maybe shows a tiny slice of example code for each.

If this doesn't exist, why not? Do thousands of developers have the entire STL memorized? Are C++ programmers still turning to printed pages when they need to look up a function prototype they've absent-mindedly forgotten?

Benji Smith
Monday, July 01, 2002

Chris,

Thanks.  I'm wayyyyy behind...

Nat Ersoz
Monday, July 01, 2002

[Just to clarify after seeing some of these replies to my original message...]

Benji, I think you missed the reference above for the SGI site. The link is:

http://www.sgi.com/tech/stl/

Nick Hebb
Monday, July 01, 2002

The book I would suggest for this is "The C++ Standard Library - A Tutorial and Reference" by Nicolai M. Josuttis.
(see the ACCU review at http://www.accu.org/bookreviews/public/reviews/cp/cp002018.htm).

This is the one I keep on my desk - it describes the STL as adopted into the ISO C++ standard, along with standard iostreams and other non-STL parts of the standard library.

For deep-tweaks of iostreams you might want "Standard C++ IOStreams and Locales" by Angelika Langer & Klaus Kreft, but Josuttis has what I nead nearly all of the time

Tim

Tim Sharrock
Tuesday, July 02, 2002

If you are really really sadistic and want to get down into it at a LOW level you can look here at the C++ standard: http://std.dkuug.dk/jtc1/sc22/open/n2356/

Matt Watson
Wednesday, July 03, 2002

Second the book : "The C++ Standard Library - A Tutorial and Reference" by Nicolai M. Josuttis." I didn't find any navigate-friendly help/manuals/documents on C++ standard library either. However, the book is the key to understand and use it effectively.

Dinkumware's documentation should serve you well, though it didn't follow the approach of Javadoc or php or mysql...

yowkee
Thursday, July 04, 2002

<<Dinkumware's documentation should serve you well, though it didn't follow the approach of Javadoc >>

Once again, I try the Silicon Graphics STL page. It's way better than Dinkumware's and the format is more toward the javaDoc style (but without the left index frame).

http://www.sgi.com/tech/stl/

Alexander Stepanov (STL author) has been working at SGI since the mid-90's, so they have a vested interest in maintain a user friendly STL reference.  Also, the whole thing is downloadable.

Nick Hebb
Thursday, July 04, 2002

Thanks everybody.

The SGI manuals are very close to what I'm looking for. I've downloaded them and added them to my documentation collection.

I also made a trip to Barnes and Noble over the weekend and found a really good dead-tree manual. It's called "C/C++ Programmer's Reference" by Herbert Schildt (ISBN: 0072127066). It's a nice almost-pocket-sized book that gives a complete language reference to the standard library (including the non-STL parts) without giving a bunch of introductory fluff or way-too-in-depth coverage. It's got the perfect amount of detail. I bought it on the spot.

So, with the combination of the SGI electronic documentation and the Schildt book, I should have all the info I need, although I would prefer it in a more JavaDoc-like format. Oh well.

Thanks again for your help.

Benji Smith
Monday, July 08, 2002

*  Recent Topics

*  Fog Creek Home