This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: vector<MyTemplate<MyClass>> not possible?
- From: "Claudio Bley" <bley at cs dot uni-magdeburg dot de>
- To: "Evert, F.K. van" <F dot K dot vanEvert at plant dot wag-ur dot nl>
- Cc: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 20 Sep 2002 11:13:14 +0200
- Subject: Re: vector<MyTemplate<MyClass>> not possible?
- References: <13480A008BD5D41184160002B31669458AA17F@bornexchange.plant.dlo.nl>
>>>>> "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 / \