STL source code

A

abi

i would like to refer to the source code of container class list for a
project implementation of mine. all that i find on a goog search is
list of header files and discussion on the c++ issues like 'concept'
etc. around that idea.
where do i find the actual source code (lets say list.cc) that
actually defines all the classes.
all that i want to learn is the underlying 'raw algorithms' in the stl
implementation of certain containers and classes

thanks
abi
 
C

Chris Theis

abi said:
i would like to refer to the source code of container class list for a
project implementation of mine. all that i find on a goog search is
list of header files and discussion on the c++ issues like 'concept'
etc. around that idea.
where do i find the actual source code (lets say list.cc) that
actually defines all the classes.
all that i want to learn is the underlying 'raw algorithms' in the stl
implementation of certain containers and classes

thanks
abi

You will have noticed that all those containers of the C++ standard library
are templates. Thus you'll find their implementation in the header files.

HTH
Chris
 
S

Sam Holden

i would like to refer to the source code of container class list for a
project implementation of mine. all that i find on a goog search is
list of header files and discussion on the c++ issues like 'concept'
etc. around that idea.

Your subject was "STL source code".

The *first* match on a google search for those three words is a web page
linking to the source code of an implementation of list (and the rest
of the STL).

where do i find the actual source code (lets say list.cc) that
actually defines all the classes.

list is a template. It is almost certainly implemented in a header
file and not a .cc file (since "export" isn't implemented by enough
compilers to be used by such a downloadable implementation.
 
A

abi

ya thanks,
i got the idea
but is there some other place on the web where only the algorithms
used by STL is
explained. (that is the underlying data structures etc. ) without
explicit reference to the code (as it is pretty confusing if I try to
read through).

thanks
 
J

John Harrison

abi said:
ya thanks,
i got the idea
but is there some other place on the web where only the algorithms
used by STL is
explained. (that is the underlying data structures etc. ) without
explicit reference to the code (as it is pretty confusing if I try to
read through).

thanks

The standard does not specify which algorithms the STL must use.
Implementers are free to choose which ever algorithm or data structure that
fulfils the functional and efficiency requirements of the standard.

There are some common choices however. For instance every implementation of
map, multimap, set and multiset that I have ever seen uses a structure
called a red black tree. Typing 'red black tree algorithm' in google
produces a number of likely looking links.

john
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top