A<T> is not derived from B<T>
SPUeNTRUP - Kai Henningsen
Kai.Henningsen@cats.ms
Fri Mar 11 16:36:00 GMT 2011
... or more precisely,
error: type ‘accessor_parameter<T, (sizeof (T) > sizeof (T*))>’ is not derived from type ‘C3Variable<T>’
In this case, I can work around this, but I'd like to understand what
is going on here. The accessor_parameter is a return type of a method of
template class C3Variable (an otherwise trivial getter method of an
instance var of type T). (The main point is to automate the decision of
transferring a value or a pointer to the value, thus the condition.)
gcc -v:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
Oh, just in case it matters:
template < class C, bool > struct accessor_parameter {
};
template <> template < class C > struct accessor_parameter <C, true > {
typedef const C & type;
};
template <> template < class C > struct accessor_parameter <C, false > {
typedef C type;
};
# define accessor_pt(T) \
accessor_parameter < T, (sizeof(T) > sizeof(T *)) >::type
... and more macros, ending in ACCESSOR_R(name, type) for a getter,
ACCESSOR_W(name, type) for a setter, and so on. I believe this is the
first time I tried to use this in a template class, however.
Mit freundlichen Grüßen aus Münster /
with kind regards - Kai Henningsen
--
SPUeNTRUP Software
An der Kleimannbrücke 52
D-48157 Münster, Germany
Reg: Münster Nr.29047
Fon: +49 700 CALL CATS (=22552287)
Fon: +49 251 322 311 0
Fax: +49 251 322 311 99
Web: http://www.cats.ms
Mail: support-kh-i@cats.ms
More information about the Gcc-help
mailing list