473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Source files for buildt-in containers in std?

I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits

But where is the .cpp source file located or are all the implementation
located in the .h file?
Jun 8 '07 #1
10 2015
desktop wrote:
I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits

But where is the .cpp source file located or are all the implementation
located in the .h file?
I suppose all implementation is in the header, as this is a template
library. But even if there was some implementation, it would only be in
the source-folder (e.g., somewhere in /usr/src) if you installed it from
source.

Otherwise, most probably only the compiled sources (.a/.so) would be there.

Yours,
Daniel

--
Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress --
so please use good, old E-MAIL!
Jun 8 '07 #2
On Jun 8, 11:10 am, desktop <f...@sss.comwrote:
I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits
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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 8 '07 #3
James Kanze wrote:
On Jun 8, 11:10 am, desktop <f...@sss.comwrote:
>I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits
>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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

In the file stl_tree.h the rotate functions are declared:
void
_Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);

void
_Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);

void
_Rb_tree_insert_and_rebalance(const bool __insert_left,
_Rb_tree_node_base* __x,
_Rb_tree_node_base* __p,
_Rb_tree_node_base& __header);

But they are not defined. 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
"professional" version.

I have tried to find a folder called g++ but I only have some binaries
starting with g++.
Jun 8 '07 #4
On 2007-06-08 16:36, desktop wrote:
James Kanze wrote:
>On Jun 8, 11:10 am, desktop <f...@sss.comwrote:
>>I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits
>>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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34


In the file stl_tree.h the rotate functions are declared:
void
_Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);

void
_Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);

void
_Rb_tree_insert_and_rebalance(const bool __insert_left,
_Rb_tree_node_base* __x,
_Rb_tree_node_base* __p,
_Rb_tree_node_base& __header);

But they are not defined. If they are not defined on my machine where
are they defined?
The implementation might be available only in binary form.
The reason I ask is because I have made my own
implementation of a red-black tree and would like to see the
"professional" version.
If you have access to a windows machine you can download and install
Visual C++ 2005 Express, there you can easily get to the implementation
by writing #include <mapin a project then right-click on <mapand
select Open Document <map>, then repeat for <xtree>.

Or you can probably find the SGI implementation with some googling.
I have tried to find a folder called g++ but I only have some binaries
starting with g++.
The folder is probably called libstdc++.

--
Erik Wikström
Jun 8 '07 #5
Erik Wikström wrote:
On 2007-06-08 16:36, desktop wrote:
>James Kanze wrote:
>>On Jun 8, 11:10 am, desktop <f...@sss.comwrote:
I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits

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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34


In the file stl_tree.h the rotate functions are declared:
void
_Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);

void
_Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);

void
_Rb_tree_insert_and_rebalance(const bool __insert_left,
_Rb_tree_node_base* __x,
_Rb_tree_node_base* __p,
_Rb_tree_node_base& __header);

But they are not defined. If they are not defined on my machine where
are they defined?

The implementation might be available only in binary form.
The reason I ask is because I have made my own
implementation of a red-black tree and would like to see the
"professional" version.

If you have access to a windows machine you can download and install
Visual C++ 2005 Express, there you can easily get to the implementation
by writing #include <mapin a project then right-click on <mapand
select Open Document <map>, then repeat for <xtree>.

Or you can probably find the SGI implementation with some googling.
>I have tried to find a folder called g++ but I only have some binaries
starting with g++.

The folder is probably called libstdc++.
Thanks found the implementation at:

http://www.sgi.com/tech/stl/download.html

what up with the

__x->_M_right = __y->_M_left;
if (__y->_M_left !=0)
__y->_M_left->_M_parent = __x;
__y->_M_parent = __x->_M_parent;

double underscore "__" syntax by the way, not the prettiest thing I have
seen.
Jun 8 '07 #6
desktop <ff*@sss.comwrote:
Thanks found the implementation at:

http://www.sgi.com/tech/stl/download.html

what up with the

__x->_M_right = __y->_M_left;
if (__y->_M_left !=0)
__y->_M_left->_M_parent = __x;
__y->_M_parent = __x->_M_parent;

double underscore "__" syntax by the way, not the prettiest thing I have
seen.
The double underscore in identifiers is reserved for use by the
"implementation", which usually includes the Standard Library. If you
follow the rule of not using double underscores in your own code, then
the chances of a name clash are drastically reduced.

There are other identifiers that are reserved to the implementation as
well (such as identifiers beginning with an underscore followed by a
capital letter (but this may only be in the global namespace)), and
recently I found out about some reserved identifiers inherited from the
C standard (such as ones beginning with 'str' or with a capital 'E').

This page (no longer maintained, so may be a little out of date)
attempts to document them:
http://web.archive.org/web/200402090...h/c-predef.htm

In summary, don't use double underscores in your own code :)

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 8 '07 #7
Marcus Kwok wrote:
The double underscore in identifiers is reserved for use by the
"implementation", which usually includes the Standard Library. If you
follow the rule of not using double underscores in your own code, then
the chances of a name clash are drastically reduced.

There are other identifiers that are reserved to the implementation as
well (such as identifiers beginning with an underscore followed by a
capital letter (but this may only be in the global namespace)), and
recently I found out about some reserved identifiers inherited from the
C standard (such as ones beginning with 'str' or with a capital 'E').
No, per 17.4.3.1.2, identifiers with an underscore followed by an
uppercase letter are reserved to the implementation in all scopes.

Identifiers with an underscore, followed by a digit or a lowercase
letter are reserved in the global (and ::std, per foootnote 165)
namespaces.
Jun 8 '07 #8
On Jun 8, 4:36 pm, desktop <f...@sss.comwrote:
James Kanze wrote:
On Jun 8, 11:10 am, desktop <f...@sss.comwrote:
I have found the stl_tree.h for a red-black tree in:
/usr/include/c++/4.1.2/bits
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:
void
_Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);
void
_Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
_Rb_tree_node_base*& __root);
void
_Rb_tree_insert_and_rebalance(const bool __insert_left,
_Rb_tree_node_base* __x,
_Rb_tree_node_base* __p,
_Rb_tree_node_base& __header);
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
libstdc++-v3/src/tree.cc.)
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
"professional" version.
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: ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 8 '07 #9
On Jun 8, 6:58 pm, desktop <f...@sss.comwrote:
Thanks found the implementation at:
http://www.sgi.com/tech/stl/download.html
what up with the
__x->_M_right = __y->_M_left;
if (__y->_M_left !=0)
__y->_M_left->_M_parent = __x;
__y->_M_parent = __x->_M_parent;
double underscore "__" syntax by the way, not the prettiest
thing I have seen.
It's prettier than what would happen if they dropped it, and
your program happened to start:

#define y 0
#define x 1
#include <map>

You're not allowed to define macros with a double underscore, or
which start with an underscore followed by a capital letter,
which accounts for the naming convention.

--
James Kanze (Gabi Software) email: ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 8 '07 #10
red floyd <no*****@here.dudewrote:
Marcus Kwok wrote:
>There are other identifiers that are reserved to the implementation as
well (such as identifiers beginning with an underscore followed by a
capital letter (but this may only be in the global namespace))

No, per 17.4.3.1.2, identifiers with an underscore followed by an
uppercase letter are reserved to the implementation in all scopes.

Identifiers with an underscore, followed by a digit or a lowercase
letter are reserved in the global (and ::std, per foootnote 165)
namespaces.
Thanks. I can never remember this exception, so I find it easier just
to remember, "don't start identifiers with an underscore, ever".

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 11 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Wells | last post by:
How do I totally remove source safe from a project? I built a project from Source Safe, then I deleted all the source save files from the working folder. That let me load up and write to the...
2
by: Davis Chord | last post by:
I'm a fairly new Python developer, so I hope that some of my ignorance in this area is understandable. :) I'm developing an application, and I'm uncertain about releasing it as open-source. The...
2
by: Newbee Adam | last post by:
what exactly is the source safe used for -- Adam S
1
by: charliewest | last post by:
I was reading more about the .NET FRAMEWORK's SDKs and i found that there exists a utilitiy that enables developers to view manifest data, assembly data and even source code! When compiling CAB...
3
by: Jackie | last post by:
Hi all, I am new to visual c++, and found that each C++ project automatically generates source files and resource files, what are their roles, respectively? Thanks a lot.
2
by: Rabbit | last post by:
I like the feature of "Publish Web Site", because it can deploy a compiled version of my web solution. But currently I need to deploy Crystal report onto IIS with only .Net 2.0, so I'm trying to...
2
by: mcdesigns | last post by:
Recently suffered a bad hard drive crash. Was able to recover most of my old source files, but most were corrupted. Does anyone know if Visual Studio does any caching of source files? Have tried...
3
by: Andy | last post by:
Hi I've just begun programming VB, attending a college course. The last weeks I've been using my workstation for projects, saving everything locally on this. But, now I would like to use my...
4
by: Horacius ReX | last post by:
Hi, I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. So I need to "mix" all my different C source files...
5
by: Joe Strout | last post by:
We have a client who's paranoid about distributing the Python source to his commercial app. Is there some way I can distribute and use just the .pyc files, so as to not give away the source? ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.