Re: C++ templates?
Re: C++ templates?
- Subject: Re: C++ templates?
- From: Dix Lorenz <email@hidden>
- Date: Fri, 16 Apr 2004 07:36:26 +0200
On 16.04.2004, at 01:04, Allan Odgaard wrote:
In that case: The implementations need to be available at
compile-time [...]
Only the implementation that he uses needs to be available.
He creates an Object:
MyMath<int> mathUtility;
That should use the constructor, which is only defined in the
.cpp-file. That makes it a needed implementation...
And actually, it doesn't really need to. Since he can explicitly
instantiate the min and max functions with the int type-parameter --
which he doesn't seem to do, but he doesn't use these functions, so
they do not need to be implemented.
ehm... that probably sounded a bit confusing... ;)
It did, but if you are trying to say what I think you are trying to say
you are just supporting my point :-)
You are saying: The compiler doesn't need the implementations of the
methods of a class-template when they are used, because they might be
explicitely defined in some .cpp-file.
In that case only the linker would know that these methods are
missing. And since I assumed zerolink is being used (which doesn't
actually link) the problem would only occur at runtime... You are
right, he doesn't use any of the functions, but he uses the constructor
and that should be enough.
Greetings,
Dix
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.