=?windows-1252?Q?Re=3A_error=3A_expected_primary=2Dexpression_before_=91int?= =?windows-1252?Q?'?=
On Nov 1, 4:38 pm, annamalai <annamalai.gurus...@gmail.com> wrote:
On Nov 1, 10:58 am, raikanta.s...@gmail.com wrote:
template <typename T1>
void testAA()
{
AA<T1> aa;
int i = aa.get<int>();
}
Ultimately what you are trying to do here is to instantiate a template
member function without explicitly instantiating the template class.
I was wrong. As pointed out by Daniel Krugler, using the template
keyword will make the above C++ program well-formed. The appropriate
section to refer is the 14.2.4 ('Names of template specializations',
n2798.pdf, page 316). Here is the example provided in the draft:
struct X {
template<std::size_t> X* alloc();
template<std::size_t> static X* adjust();
};
template<class T> void f(T* p) {
T* p1 = p->alloc<200>(); // ill-formed: < means less than
T* p2 = p->template alloc<200>(); // OK: < starts template argument list
T::adjust<100>(); // ill-formed: < means less than
T::template adjust<100>(); // OK: < starts template argument list
}
I understand this better now.
Rgds,
anna
--
Copyright of Wedding Album Must Belong to Family (The Producers)
http://tinyurl.com/d0253082-copyright
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]