This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
A<T> is not derived from B<T>
- From: SPUeNTRUP - Kai Henningsen <Kai dot Henningsen at cats dot ms>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 11 Mar 2011 17:35:10 +0100
- Subject: A<T> is not derived from B<T>
- Lisbeth-delivered-to: {}gcc-help{}@gcc.gnu.org Fri, 11 Mar 2011 17:35:49 +0100 (router smarthost)
- Lisbeth-delivered-to: {}gcc-help{}@gcc.gnu.org Fri, 11 Mar 2011 17:35:49 +0100 (transport remote_smtp)
- Reply-to: kai-gcc-help-i at cats dot ms
... 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