STL Standards Document

R

RR

I have Plauger's book on STL and I've found that it's different from the STL
I have on a Linux box (libstdc++-2.96-112).

In particular, the map::erase(iterator) method I have returns nothing
(void), not "iterator".

So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
contain the definitive current standard for STL and all its templates?

Is that the recommended document to find the correct STL semantics, or is
there a better document?

TIA,
RR
 
J

John Carson

RR said:
I have Plauger's book on STL and I've found that it's different from
the STL I have on a Linux box (libstdc++-2.96-112).

In particular, the map::erase(iterator) method I have returns nothing
(void), not "iterator".

So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
contain the definitive current standard for STL and all its templates?

Of course. You will find the following declaration for map on p.498:

void erase(iterator position);
Is that the recommended document to find the correct STL semantics,
or is there a better document?

Most people use Nicolai Josuttis: The C++ Standard Library. But the standard
is the definitive source.
 
A

Alf P. Steinbach

* RR:
I have Plauger's book on STL and I've found that it's different from the STL
I have on a Linux box (libstdc++-2.96-112).

In particular, the map::erase(iterator) method I have returns nothing
(void), not "iterator".

void erase( iterator position );
size_type erase( key_type const& x );
void erase( iterator first, iterator last );


So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
contain the definitive current standard for STL and all its templates?

No, the C++ standards document contains the C++ standard, including the
C++ standard library, but referring to the C89 (?) standard for some pure
C things, including some pure C standard library things.

STL is not C++ (an early STL was originally implemented in Ada).

STL predates the standardization of C++ (it was the result of a bacterial
infection, while C++ was ... well); parts of STL are part of the C++
standard library; parts of STL, e.g. hash tables, are not.

Is that the recommended document to find the correct STL semantics, or is
there a better document?

For the C++ library: the C++ standard.

For STL: e.g.
<url: http://www.cs.utexas.edu/users/lavender/courses/stl/>.
<url: http://www.sgi.com/tech/stl/>
 
R

RR

Thanks. Just bought the standard and it's easier to read and clearer than
Plauger.

And, it answered all the questions are really needed to know right now!

Alf: thanks for the heads up on hashes, etc., but the URLs you provided are
way out of date (circa 1995). How valid do you think they are now with the
STL libraries that have been shipped in the last few years?
 
A

Artie Gold

RR said:
I have Plauger's book on STL and I've found that it's different from the STL
I have on a Linux box (libstdc++-2.96-112).
*Upgrade* to a later version. Pre-3.0 g++s are notoriously non standards
compliant.
In particular, the map::erase(iterator) method I have returns nothing
(void), not "iterator".

So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
contain the definitive current standard for STL and all its templates?
Yes.

Is that the recommended document to find the correct STL semantics, or is
there a better document?

It is. The Dinkumware web site (http://www.dinkumware.com) also has a
good online reference.

HTH,
--ag
 
S

Stephen Howe

I have Plauger's book on STL and I've found that it's different from the
STL
I have on a Linux box (libstdc++-2.96-112).

The book was published well before the standard was finalised.
So do not be surprised if some details vary.
They represent changes after the book was published but before the standard
was finalised.
The book has historical interest, but I would not rely on it as a definitive
authority on the C++ library
(and I doubt whether Plauger would want you to :) )
So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
contain the definitive current standard for STL and all its templates?
Yes.

Is that the recommended document to find the correct STL semantics, or is
there a better document?

It is the most authorative document but you might find other sources more
readable.

Stephen Howe
 
J

John Carson

RR said:
I checked that first, and it's wrong, just like the book (on
map::erase(iterator), for example).

It correctly describes the Dinkumware implementation, which in this respect
appears to diverge from the standard.
 
A

Alf P. Steinbach

* RR:
Thanks. Just bought the standard and it's easier to read and clearer than
Plauger.

And, it answered all the questions are really needed to know right now!

Alf: thanks for the heads up on hashes, etc., but the URLs you provided are
way out of date (circa 1995). How valid do you think they are now with the
STL libraries that have been shipped in the last few years?

Very.

The first link provides Stepanov's STL spec in Postscript and PDF (Stepanov
was the main author of the STL).

The second one is to the SGI implementation (again, Stepanov).

You can't get more accurate information than the original...

STL is not the C++ standard library, nor vice versa.
 
P

Pete Becker

RR said:
I checked that first, and it's wrong, just like the book (on
map::erase(iterator), for example).

It's not wrong, it's just ahead of its time. <g> At the last standards
committee meeting we changed iterator erases for associative containers
to return an iterator, just as they do for sequence containers.
 
M

Mark P

Alf said:
* RR:



Very.

The first link provides Stepanov's STL spec in Postscript and PDF (Stepanov
was the main author of the STL).

I'm not so sure. I took a quick look at the pdf STL manual and noticed
that the section on Allocators makes no mention of the rebind mechanism.
Haven't there been important changes to the STL spec in the last ten
years?

Mark
 
R

RR

Pete Becker said:
It's not wrong, it's just ahead of its time. <g> At the last standards
committee meeting we changed iterator erases for associative containers
to return an iterator, just as they do for sequence containers.

OK. Looks like I'll be able to use the book in a few years time! ;-)

TIA,
RR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,200
Latest member
SCPKatheri

Latest Threads

Top