Avoid typename repetition in template specialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

suppose a templated class:

template< typename T >
struct A {
	const T& some_function( const T& )
	T i[10];
};

and a specialization for some type, say
PSpinVector< PColorVector< RComplex<REAL64>, Nc>, Ns >:

template<>
struct A<PSpinVector< PColorVector< RComplex<REAL64>, Nc>, Ns > > {
const PSpinVector< PColorVector< RComplex<REAL64>, Nc>, Ns >& some_function( const PSpinVector< PColorVector< RComplex<REAL64>, Nc>, Ns
& )
	PSpinVector< PColorVector< RComplex<REAL64>, Nc>, Ns > i[10];
};

Is there a way to avoid the redundant typing of the specialized typename in the template specialization?

I know, using templates would exactly avoid this. But I really need this kind of specialization to specialize the some_function

I would not like to use the preprocessor. Like:

#define PSpinVector< PColorVector< RComplex<REAL64>, Nc>, Ns > T
template<>
struct A<T> {
	public:
	const T& some_function( const T& )
	T i[10];
}
#undef T


Isn't there a template-way of doing this?


Best regards,
Frank Winter


--

Institut fuer theoretische Physik
Universitaet Regensburg
Universitaetsstr. 31
93053 Regensburg
Germany

office +49 (0)941 943 2085

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux