Subject: [Dev] STL

From: "M. Mueller/bhu5nji" <[email-masked]>
Date: Sat, 5 Jan 2002 12:08:46 -0500

Anyone out there using or used the C++ Standard Template Library?  I want a 
dynamic list and the thought of writing another drove me to find STL.  I 
bought a book (STL Tutorial and Reference Guide, 2nd Ed. by Musser, Derge, 
and Saini) that seems well written.

Mike

---

From: Brent Verner <[email-masked]>
Date: Sun, 6 Jan 2002 00:24:49 -0500

[2002-01-05 12:08] M. Mueller/bhu5nji said:
| Anyone out there using or used the C++ Standard Template Library?  I want a 
| dynamic list and the thought of writing another drove me to find STL.  I 
| bought a book (STL Tutorial and Reference Guide, 2nd Ed. by Musser, Derge, 
| and Saini) that seems well written.

I've hacked around the stl a bit.  If you have problems, I'll do my
best to help, but I'm not a regular c++ coder.

  b

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

---

From: Ed Hill <[email-masked]>
Date: 05 Jan 2002 22:55:44 -0700

> and Saini) that seems well written.

Hi Mike,

I've used the STL a lot in the past (originally with the Rogue Wave STL
implementation on HP-UX and Suns and later with EGCS/GCC on Linux). 
I've found that it can be *QUITE* painful to port STL code from one
compiler/library to another or even to a newer rev of the same
compiler/library.  The reason is that different template libraries are
of varying complexity (using more or less template features) and they
tend to *really* exercise the compiler.  So be careful!   Stuff that I
wrote that worked well with the old HP aC++ and EGCS releases is now
very broken with the RH 7.x gcc (gcc "2.96"), with the more recent 3.x
gcc versions, and with other C++ compilers.  And broken template code
just sucks to debug.

In terms of STL docs, I've used B. Stroustrup's text (excellent), the
Rogue Wave HTML docs that come with their implementation (ok), online
docs from the SGI STL implementation (ok), and some more esoteric refs
(eg. Barton & Nackman's "Scientific and Engineering C++").

If all you want are decent implementations of some data structures and
algorithms, then I strongly suggest that you look into something other
than the STL.  Take a good look at the C-based Glib

  http://developer.gnome.org/arch/gtk/glib.html

library which you can, of course, use within C++.  Its *very* portable. 
And most of the data structures and algorithms that you're likely want
are in there...

hth,
Ed 

-- 
Edward H. Hill III, PhD
Post-Doctoral Researcher   |  Email:       [email-masked], [email-masked]
Division of ESE            |  URL:         http://www.eh3.com
Colorado School of Mines   |  Phone:       303-273-3483
Golden, CO  80401          |  Fax:         303-273-3311
GnuPG Key ID:  1E76F123    |  Public key:  http://www.eh3.com/eh3.gpg

---

From: Tanner Lovelace <[email-masked]>
Date: 06 Jan 2002 03:48:27 -0500

> gcc versions, and with other C++ compilers.  And broken template code

Unless you're writing STL code under windows using Visual C++ (which,
btw, sucks for template support) you shouldn't have any problem
using the STL.  That may have been different in the past, but now that
we have a standard and compilers are actually implementing it, there
shouldn't be any problems.  If there are, you can always uses the SGI
STL...
 
> (eg. Barton & Nackman's "Scientific and Engineering C++").

I would highly, highly, highly, highly, highly, highly, highly recommend
"The C++ Standard Library" by Josuttis (published by Addison Wesley).
It is by far the best STL book I have ever seen (and I've looked at 
several, but not the latest version of Musser and Saini...)

> And most of the data structures and algorithms that you're likely want
Yes, you can use glib in C++, but you lose way too much of the 
power of C++.  Face it.  Using C code when you could use C++
is a hack.  It's ugly and it makes you do way to much stuff.  C++
was written so you don't have to do that stuff so you might as
well use it.

Okay, now that everyone knows my biases :-) I'll go back to what
I was doing.

Tanner Lovelace
-- 
Tanner Lovelace | [email-masked] | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint = A66C 8660 924F 5F8C 71DA  BDD0 CE09 4F8E DE76 39D4
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
 Those who are willing to sacrifice essential liberties for a little 
 order, will lose both and deserve neither.  --  Benjamin Franklin 

 History teaches that grave threats to liberty often come in times
 of urgency, when constitutional rights seem too extravagant to 
 endure.  --  Justice Thurgood Marshall, 1989

---

From: "M. Mueller/bhu5nji" <[email-masked]>
Date: Sat, 5 Jan 2002 23:53:49 -0500

Thanks for the comments.  I added a couple more below.

Mike

> several, but not the latest version of Musser and Saini...)

I did a stare and compare of the Josuttis book (copyright 1999 $49) and the 
Musser et al 2nd. Ed. (copyright 2001 $44) at my local Borders.  They were 
quite similar.  I opted to the Musser book for 4 reasons: 1) more recent 
copyright, 2) Musser is professionally close to Stepanov, 3) Addison Wesly 
Professional Computing Series have been good choices in the past, and 4) the 
reference material was slightly more verbose.  I felt a bit rebellious since 
Amazon reviews were similar in nature to the one above.

> was written so you don't have to do that stuff so you might as

I also recall that GLIB is covered by the GPL and the C++ Stand Library is 
covered by the LGPL.  As I am developing a commercial application, the LGPL 
is more attractive to me as well.

---

From: Tanner Lovelace <[email-masked]>
Date: 06 Jan 2002 16:55:42 -0500

> Amazon reviews were similar in nature to the one above.

There's a reason the reviews are like that. :-)  Like I said, however,
I haven't seen Musser 2nd ed. so it could be just as good.  I know
that the 1st edition is considered the seminal work...

Don't discount Josuttis too much though.  I belive he was one the
committee that worked on standardizing the STL.  This, to me, counts
for more since the STL has changed considerably since Stepanov
first introduced it (for the better of course:).

> is more attractive to me as well.

No, glib is LGPL.  STL, however, being part of the standard
C++ library, is available under whatever kind of license you
want.  In fact, if your C++ compiler doesn't include it, it's
not a (standards compliant) C++ compiler. :-)

Tanner
GPG Key can be found at http://wtl.wayfarer.org/lovelace.gpg.asc