Problem with template functions
Olli Aalto
oaalto at gmail.com
Thu Jan 11 05:41:43 PST 2007
Hi!
I've gotten myself into a jam. I've written several templated functions
which work correctly inside their own modules. I have two modules with
different kinds of functions, but which couple have the same name ond/or
alias.
I've written a small example of the problem:
module1.d:
module module1;
private void _templateFuntion(int T, A...)(int[T][T] arr, A args)
{
}
public alias _templateFuntion!(2, int, int) func;
module2.d:
module module2;
import module1;
private void _templateFuntion(int T, A...)(int[T] arr, A args)
{
}
public alias _templateFuntion!(2, int, int, int) func;
void main()
{
int[2][2] array;
array.func(2, 3);
}
Compiler output:
module2.d(14): function
module2._templateFuntion!(2,int,int,int)._templateFuntion (int[2],(int,
int, int)) does not match parameter types (int[2][2],int,int)
module2.d(14): Error: cannot implicitly convert expression (array) of
type int[2][2] to int[2]
module2.d(14): Error: expected 4 arguments, not 3
For some reason the compiler doesn't see the template function from module1.
Am I doing something wrong or is this something that is just not yet
supported?
O.
More information about the Digitalmars-d-learn
mailing list