Hi,
I am probably asking for something which was discussed several times,
but all my researches were unsucessfull.
If you look at this code (simplified part of my project):
---------------
template< int dimension > struct Test
{
template< class A > struct assignement
{
template< int I > struct recurse
{
enum { Counter = I + 1 };
static inline void assign( void* v, const A& a )
{
recurse<Counter>::assign( v, a );
}
};
template<> struct recurse<dimension>
{
enum { Counter = dimension + 1 };
static inline void assign( void*, const A& )
{
}
};
static inline void assign( void* v, const A& a )
{
recurse<0>::assign( v, a );
}
};
};
---------
This code compiles fine with vs2005, but not with g++, which gives me
errors on my specialization template<> struct recurse<dimension>:
error: invalid explicit specialization before '>' token
error: explicit specialization in non-namespace scope `struct
Test<dimension>::assignement<A>'
error: enclosing class templates are not explicitly specialized
error: template parameters not used in partial specialization:
error: `A'
Even though i thought this was completely correct, i tried to put it
outside the class definition, but couldnt get it working.
So i am wondering if what i am doing is actually proper c++, or just
something vs allows? And if you would have a work around..
Thanks!