[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++
From: |
olafBuddenhagen |
Subject: |
Re: C++ |
Date: |
Tue, 10 Nov 2009 18:04:39 +0100 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
Hi,
On Mon, Nov 09, 2009 at 06:57:06AM +0100, Bas Wijnen wrote:
> On Fri, Nov 06, 2009 at 10:36:10PM +0100, address@hidden 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-
- Re: C++, (continued)
- Re: C++, Bas Wijnen, 2009/11/09
- Re: C++, William Leslie, 2009/11/09
- Re: C++, Michal Suchanek, 2009/11/09
- Re: C++, Bas Wijnen, 2009/11/09
- Re: C++, Jonathan S. Shapiro, 2009/11/09
- Re: C++, Sam Mason, 2009/11/09
- Re: C++, Jonathan S. Shapiro, 2009/11/09
- Re: C++, Sam Mason, 2009/11/09
- Re: C++, LluĂs, 2009/11/11
- Re: C++, Jonathan S. Shapiro, 2009/11/09
- Re: C++,
olafBuddenhagen <=