Re: Source files for buildt-in containers in std?
On Jun 8, 4:36 pm, desktop <f...@sss.com> wrote:
James Kanze wrote:
On Jun 8, 11:10 am, desktop <f...@sss.com> wrote:
I have found the stl_tree.h for a red-black tree in:
But where is the .cpp source file located or are all the
implementation located in the .h file?
Who knows? It's up to the implementation. The path you give
suggests g++, in which case, there's probably a file .tcc
somewhere in the bits directory, with the actual implementation.
With a good compiler, however, one that implements export, it's
not even certain that the implementation is present on the
machine. And every implementation has its own strategy for
handling this when the compiler doesn't implement export. But
about the only time any of this is relevant is when you're
debugging the library yourself.
In the file stl_tree.h the rotate functions are declared:
_Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
_Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
_Rb_tree_insert_and_rebalance(const bool __insert_left,
But they are not defined.
They're certainly defined somewhere. As they're not templates,
probably somewhere in the standard library (libstdc++.a or
libstdc++.so for g++ under Linux). The sources are somewhere in
the g++ source tree. (In the version I have, they're in
If they are not defined on my machine where
are they defined? The reason I ask is because I have made my own
implementation of a red-black tree and would like to see the
I have tried to find a folder called g++ but I only have some
binaries starting with g++.
I'm not sure what you mean by "folder". The sources should be
under the source tree for gcc, but I can't tell you where (or
even if) that's installed on your system. If worse comes to
worse, you can go to a gcc mirror and download the sources from
there, just as you would do if you were going to build the
compiler yourself. (I do build my own versions of g++, which is
why I have the source tree handy. Where that not the case,
however, I probably wouldn't bother installing it, although it
should be on the same CD as gcc was.)
James Kanze (Gabi Software) email: firstname.lastname@example.org
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34