Actual C++ Library Source Code

T

Tomás

Is there anywhere on the internet where you can download actual source
code of an implementation of the C++ library? Stuff like:

namespace std {
class string {
// actual code in here
}
}


-Tomás
 
P

Phlip

Tomás said:
Is there anywhere on the internet where you can download actual source
code of an implementation of the C++ library? Stuff like:

namespace std {
class string {
// actual code in here
}
}

Besides STLport?
 
R

Roberto Waltman

Tomás said:
Is there anywhere on the internet where you can download actual source
code of an implementation of the C++ library? Stuff like:

namespace std {
class string {
// actual code in here
}
}
-Tomás

All 'big' open source operating systems make available the full source
code for their libraries. Go to the web sites for any Linux
distribution, NetBSD, FreeBSD, OpenBSD, minix, OpenSolaris, etc.
For the STL in particular, search for STLport.
 
W

Walter Bright

Phlip said:
Besides STLport?

Although it's not free, the Digital Mars C++ compiler CD comes with full
library source code. For a free version, there is of course the gnu
implementation.

-Walter Bright
www.digitalmars.com C, C++, D programming language compilers
 
D

Daniel T.

"Tomás said:
Is there anywhere on the internet where you can download actual source
code of an implementation of the C++ library? Stuff like:

namespace std {
class string {
// actual code in here
}
}

I can't believe no one mentioned this one.
<http://www.sgi.com/tech/stl/>

It's based on Hewlett-Packard's original code (as is gnu's version I
believe...)
 
R

Roberto Waltman

Daniel T. said:
I can't believe no one mentioned this one.
<http://www.sgi.com/tech/stl/>

It's based on Hewlett-Packard's original code (as is gnu's version I
believe...)

I always thought of STLport, (that I and others mentioned,) as a
better, more up-to-date version of SGI's STL, on which it is based.

Are there any reasons to prefer SGI's STL over STLport?
 
D

Daniel T.

Roberto Waltman said:
I always thought of STLport, (that I and others mentioned,) as a
better, more up-to-date version of SGI's STL, on which it is based.

Are there any reasons to prefer SGI's STL over STLport?

I'm thinking that Tomas wants to study the code to see how it works and
I expect that SGI's version is probably simpler than STLport (though I
could be wrong, I see now that SGI does still revise theirs.)

I think it would be most instructive for Tomas to try to implement his
own STL. :)
 
M

Michiel.Salters

Tomás said:
Is there anywhere on the internet where you can download actual source
code of an implementation of the C++ library? Stuff like:

namespace std {
class string {
// actual code in here
}
}

The GNU C++ library is probably the only option. Some other posts
mention
STLPort, but it's rather incomplete. It assumes that a large port of
the
C++ library is already present, and adds Standard Templates to the
Library
(Hence the "STL" in STLPort). For instance, std::string is
template-based
( basic_string<char> ) and is in STLPort; std::strlen() isn't.

Of course, many commercial compilers also include the actual sources of
their standard C++ libraries. Have you looked at yours?

HTH,
Michiel Salters
 
P

P.J. Plauger

Tomás said:
Is there anywhere on the internet where you can download actual source
code of an implementation of the C++ library? Stuff like:

namespace std {
class string {
// actual code in here
}
}

The GNU C++ library is probably the only option. Some other posts
mention
STLPort, but it's rather incomplete. It assumes that a large port of
the
C++ library is already present, and adds Standard Templates to the
Library
(Hence the "STL" in STLPort). For instance, std::string is
template-based
( basic_string<char> ) and is in STLPort; std::strlen() isn't.

---
[pjp] Actually, the two libraries have comparable coverage. Libstdc++
(the library shipped with gcc) is just the C++ part. It depends on
whatever local C library is provided by the OS. In the case of Linux,
that happens to be glibc, the (more or less) Standard C library that's
also part of Project GNU. On Solaris, it uses the C library from Sun.
On the Mac OS it's the FreeBSD C library. etc. etc. STLport does
essentially the same thing. (And hence, both libraries are missing
many of the additions to the C library mandated by the C++ Standard.)

Libstdc++ is designed to work only with gcc, while STLport endeavors
to some degree of portability. OTOH, Libstdc++ is still actively
maintained, while STLport has been in the doldrums for the past
several years. (In fact, the STLport support forums went "offline
for maintenance" about a month ago and never came back. What's left
of the volunteer maintenance effort can now be found on SourceForge.)
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top