Solved

Is there a public domain template library that I can incorporate into my code?

Posted on 2000-03-21
3
184 Views
Last Modified: 2013-12-14
Ideally this would be a subset of STL (perhaps with
the names changed systematically to avoid
name conflicts with STL) that I could include in  my
code so that I don't have to rely on STL implementations being consistent.

I am just looking for the basic stuff:  
   Linked lists, vectors, trees
 implemented cleanly and portably.

 Nothing fancy.
0
Comment
Question by:klopter
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 2640781
>> names changed systematically to avoid
>> name conflicts with STL)
You can always use namespaces to prevent these problems.  The STL names are al in the "std" namespace.

>> so that I don't have to rely on STL
>> implementations being consistent.
Why woud this matter?  You should only care about the interface, not the implimentation.  

Sometimes the implimentation MUST be different.  For example streams must eventually contain OS-specific code to read and write from a file.

If you really have to do this, just copy the STL files from your compiler to a new name and modify them to use a different namespace.  Then just use these files.  But I really have to wonder if there is a good reason to do this.
0
 

Author Comment

by:klopter
ID: 2640855
The upshot is that I want to start
using STL, but I just want to start
by dipping my big toe in.  


The code that I am working on does
not use STL.  Maybe that was the
right decision two years, maybe it
isn't now.  

If I start using STL and as a result
we have portability problems, I
will pay the price AND they will
never use STL again.

I am only interested in container
classes at this point.  Nothing
system specific.  

My thought was that if I could snag
a bit of a public domain STL and
use it, I could get that big toe
wet without risking bumping into
portability problems.

Ken
0
 
LVL 22

Expert Comment

by:nietod
ID: 2641251
What compiler/OS are you using and what compiler/OS might you be porting to?  (To get an idea of what sort of problems you might expect).

If you stick to the "core" parts of STL and the less advanced features you are less likley to run into problems and it does sound like you are not goign to be a "power user" and get into the more remote things.  I really don't think you will find problems unless you are forced to use a very old compiler.

>> if I could snag
>> a bit of a public domain STL and
>> use it, I could get that big toe
>> wet without risking bumping into
>> portability problems.
Reasonable, but wrong.  The different versions of STL out there tend to be written to isolate you from differences among compilers.  That is they themselves are non-portable, but they are written so that code that uses them will be portable.  Does that  make sense?  For example, some compilers don't yet support template member functions (template functions that are class members).  The official STL classes use this feature.  So versions of STL that don't support template member functions are "crippled" so that the feature isn't required, plust they may contain additional code so that the missing feature is not usually missed.  Versions of STL that do support template member functions, do have the ful feature.  So the STL code itself will not be portable from a compiler that supports template member functions to a compiler that doesn't suppport them.  However code that uses the STL will be protable, unless it happens to use this feature in a way that the "patched" STL didn't anticipate.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reference external folders in Visual Studio 4 77
FMX enumerated colours 2 84
C++ Class Serialization, Encapsulation and Formatted Output 8 54
Header of docx file 17 98
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now