vector<MyTemplate<MyClass>> not possible?
Claudio Bley
bley@cs.uni-magdeburg.de
Fri Sep 20 02:13:00 GMT 2002
>>>>> "FK" == Evert, F K van <F.K.vanEvert@plant.wag-ur.nl> writes:
FK> When I put instances of a template-derived class in a STL
FK> vector, g++ gives me the following error message
FK> (Cygwin/g++3.2 as well as Suse8.0/g++2.95.3):
FK> /usr/include/c++/3.2/bits/stl_construct.h:78: passing `const
FK> SmartPtr<CX>' as `this' argument of `SmartPtr<T>::operator
FK> T*() [with T = CX]' discards qualifiers
FK> operator T*() { return m_pI ;}
should be: operator T*() const { return m_pI; }
Generally, it's a good idea to declare all member functions `const'
which don't change the state of their class instance.
--
Claudio Bley _
ASCII ribbon campaign ( )
ICQ# 83197241 - against HTML email X
http://www.cs.uni-magdeburg.de/~bley/ & vCards / \
More information about the Gcc-help
mailing list