Topic: Can return type depend on template param?
Author: geert@cs.ruu.nl (Geert-Jan Giezeman)
Date: 1996/08/06 Raw View
Can the return type of a function template depend on the parameter as in the
funcion foo in the following example?
Different compilers have different opinions. Reading the DWP I could not make
up my mind.
template <class x>
struct C {
typedef x XT;
x c;
};
template <class A>
/* typename */ A::XT foo(const A& a)
{
return a.c;
}
main()
{
int result;
C<int> cint;
cint.c = 3;
result = foo(cint);
return result;
}
--
Geert-Jan Giezeman, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 2534096
Telefax: +31 30 2513791 Email: geert@cs.ruu.nl
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]