STL Standards Document | | |
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 | | | | re: STL Standards Document
"RR" <newspaper.20.broom@spamgourmet.com> wrote in message
news:JJTfe.8108$31.1943@news-server.bigpond.net.au[color=blue]
> 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?[/color]
Of course. You will find the following declaration for map on p.498:
void erase(iterator position);
[color=blue]
> Is that the recommended document to find the correct STL semantics,
> or is there a better document?[/color]
Most people use Nicolai Josuttis: The C++ Standard Library. But the standard
is the definitive source.
--
John Carson | | | | re: STL Standards Document
* RR:[color=blue]
> 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".[/color]
void erase( iterator position );
size_type erase( key_type const& x );
void erase( iterator first, iterator last );
[color=blue]
> So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
> contain the definitive current standard for STL and all its templates?[/color]
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.
[color=blue]
> Is that the recommended document to find the correct STL semantics, or is
> there a better document?[/color]
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/>
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? | | | | re: STL Standards Document
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?
--
RR | | | | re: STL Standards Document
RR wrote:[color=blue]
> 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).
>[/color]
*Upgrade* to a later version. Pre-3.0 g++s are notoriously non standards
compliant.
[color=blue]
> 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?[/color]
Yes.[color=blue]
>
> Is that the recommended document to find the correct STL semantics, or is
> there a better document?[/color]
It is. The Dinkumware web site ( http://www.dinkumware.com) also has a
good online reference.
HTH,
--ag
--
Artie Gold -- Austin, Texas http://it-matters.blogspot.com (new post 12/5) http://www.cafepress.com/goldsays | | | | re: STL Standards Document
"Artie Gold" <artiegold@austin.rr.com> wrote in message
news:3eak53F239o3U1@individual.net...[color=blue]
> It is. The Dinkumware web site ( http://www.dinkumware.com) also has a
> good online reference.
>[/color]
I checked that first, and it's wrong, just like the book (on
map::erase(iterator), for example).
--
RR | | | | re: STL Standards Document
>I have Plauger's book on STL and I've found that it's different from the[color=blue]
>STL
> I have on a Linux box (libstdc++-2.96-112).[/color]
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 :-) )
[color=blue]
> So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003)
> contain the definitive current standard for STL and all its templates?[/color]
Yes.
[color=blue]
> Is that the recommended document to find the correct STL semantics, or is
> there a better document?[/color]
It is the most authorative document but you might find other sources more
readable.
Stephen Howe | | | | re: STL Standards Document
"RR" <newspaper.20.broom@spamgourmet.com> wrote in message
news:miVfe.8177$31.2347@news-server.bigpond.net.au[color=blue]
> "Artie Gold" <artiegold@austin.rr.com> wrote in message
> news:3eak53F239o3U1@individual.net...[color=green]
>> It is. The Dinkumware web site ( http://www.dinkumware.com) also has a
>> good online reference.
>>[/color]
>
> I checked that first, and it's wrong, just like the book (on
> map::erase(iterator), for example).
>[/color]
It correctly describes the Dinkumware implementation, which in this respect
appears to diverge from the standard.
--
John Carson | | | | re: STL Standards Document
* RR:[color=blue]
> 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?[/color]
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.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? | | | | re: STL Standards Document
RR wrote:[color=blue]
>
> I checked that first, and it's wrong, just like the book (on
> map::erase(iterator), for example).
>[/color]
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.
--
Pete Becker
Dinkumware, Ltd. ( http://www.dinkumware.com) | | | | re: STL Standards Document
Alf P. Steinbach wrote:[color=blue]
> * RR:
>[color=green]
>>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?[/color]
>
>
> Very.
>
> The first link provides Stepanov's STL spec in Postscript and PDF (Stepanov
> was the main author of the STL).
>[/color]
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
[color=blue]
> 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.
>[/color] | | | | re: STL Standards Document
"Pete Becker" <petebecker@acm.org> wrote in message
news:PPmdncQKsvSsLh3fRVn-iQ@rcn.net...[color=blue]
> 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.[/color]
OK. Looks like I'll be able to use the book in a few years time! ;-)
TIA,
RR |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|