nooneinparticular314159@yahoo.com
10/12/2008 4:57:00 PM
On Oct 12, 3:03 am, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
> nooneinparticular314...@yahoo.com wrote:
> b) Why "If"? You should know, you have the code.
It did work perfectly. Thank you. :-) That was the problem with my
syntax.
> Huh? What do you mean by "same set of arguments"?
>
> a) The number: two arguments are passed.
> b) The values: you can only call MOO<a,b> from MOO<a,b>.
>
> (a) is true. (b) is false.
What I mean is, the template for the recursive case takes two
arguments, and must have those, because it is operating on two
integers. So that's ok so far. But then for the termination step,
the template has only one argument even though the struct has two
arguments (one of which I supply.) But when Moo calls itself, it is
calling itself with two arguments. ie:
Moo calls Moo(a,b), and Moo requires two arguments so each time Moo is
called, I would think that the compiler would be checking for a
template that either takes two arguments (the two integers), or for a
template<> which indicates specialization. But neither of these is
true for the termination step. The termination template has *one*
argument (although the struct has two, one supplied by me as a
constant). So I would think that that would never match the call to
Moo, and that is where I am getting confused. How can this work with
just one argument when the template is always called with two?
Thanks!