[TriLUG] The C++ STL library
Mike Mueller
linux-support at earthlink.net
Fri Dec 5 11:13:23 EST 2003
On Friday 05 December 2003 10:09, Tanner Lovelace wrote:
> Mike Mueller wrote:
> > On Thursday 04 December 2003 16:13, Tanner Lovelace wrote:
> >>The STL is somewhat unique in that you don't compile it. Because of how
> >>templates work with most compilers, the STL is supplied entirely as
> >>header files.
> >
> > Templates have no compilable meaning until supplied with concrete data
> > types in a particular instance, so they must always be a header file.
> > How could it be otherwise - especially if the datatype is user defined?
>
> That wasn't always the case. Also, some compilers will let you
> define certain types to be precompiled. I.e. if you know that
> your template will be often used with int's you could precompile that
> part and therefore save some compile time. Also, I believe some
> compilers used to compile to an intermediate representation that
> was between source code and actual object code. The advantage of
> this would also be faster compilation.
That makes sense. My files that use STL have a noticeably slower
compile time.
I have a strong memory of the afternoon when the typical nature of templates
became suddenly clear to me. Prior to that event I was thinking of the STL
containers as precompiled objects I would link. The compiler error messages
I was getting were maddeningly abtruse (as most STL related compiler error
messages are). I spent zero time writing my own templates before using STL
in grand fashion, so I might be forgiven this temporary yet egregious void in
my understanding of templates.
--
Mike Mueller
324881 (08/20/2003)
Make clockwise circles with your right foot.
Now use your right hand to draw the number "6" in the air.
More information about the TriLUG
mailing list