templated constructor specialization?

J

Jeff Flinn

Is this allowed:

struct A{};
struct B{};

class C
{
public:

template< class T > C( int aInt, const T& );

template<> C<A>( int a Int, const A& ){}
template<> C<B>( int a Int, const B& ){}
};

Thanks, Jeff
 
V

Victor Bazarov

Jeff said:
Is this allowed:

struct A{};
struct B{};

class C
{
public:

template< class T > C( int aInt, const T& );

template<> C<A>( int a Int, const A& ){}
template<> C<B>( int a Int, const B& ){}
};

No. 14.7.3/2 requires them to be declared at the namespace level.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,965
Members
47,512
Latest member
FinleyNick

Latest Threads

Top