Solved

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

Posted on 2000-03-21
3
182 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
Comment Utility
>> 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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

771 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

7 Experts available now in Live!

Get 1:1 Help Now