[prog] C++ Templates

Sue Stones suzo at bigpond.net.au
Thu Jun 26 22:50:21 EST 2003



On Thu, 26 Jun 2003 10:33 pm, Christine Bussman wrote:
> Please note that I'm just a beginner myself, so these are
> just the things I would try myself, or things that look
> wrong to me.  I'm also looking at a text I've used in the
> past.

thanks for your comments Christine, you have obviously written a template 
before,
so you are more experience than me!

> 1.  I've always used template <class T> rather than
> <typename T>, I don't know if this will make a difference

On this fact I know for sure that it makes no difference.  That is clear from
the books, and both pass the compiler.

> 2.  I've also been taught to use :: rather than : for class
> member functions.

this was an initialisation, not an indication of a class membership.

If I have <template T> in place I get compiler errors,
if I don't have <template T> in place I get compiler errors,
if I have Ordlist:: in place I have compiler errors,
if I don't have Ordlist:: in place I have compiler errors,

I am out of things to try, that is why I am asking on the list.

If you have a copy of a template class that you have that compiles I would
love to see it, it might help me work it out.  All I jhave is some snippits
of code that are too complicated for me to figgure out what is happening.

One of the exaples was template<> if the unknown type was not used in the
function, but I don't know whether the compiler will accept that or no,
because I can't get that far.

sue



More information about the Programming mailing list