Hi,
On Mon, Nov 09, 2009 at 06:57:06AM +0100, Bas Wijnen wrote:
> On Fri, Nov 06, 2009 at 10:36:10PM +0100, [email protected] wrote:
> > While I'm not really familiar with templates (they didn't exist when
> > I was learning C++), my understanding is that I have to write a template
> > instead of a "normal" function, and then explicitely ask for specific
> > functions being instanciated from this template for the types I need.
> For example, when I define a template function like this:
>
> template <typename T> T &minimum (T a, T b)
> {
> return a < b ? a : b;
> }
>
> I can simply call the function as minimum (3, 6);, and it will work
> with any type that has operator< defined. Only if the compiler cannot
> know what type you want, do you need to specify it.
Oh, interesting... Seems I did indeed misunderstand that.
So I agree that templates can be nice in some situations... Not enough
though to make me want to use C++ :-)
-antrik-