Discussion: Template operators
Afficher un message
Vieux 07/04/2008, 17h38   #4
D-Dog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Template operators

On Apr 7, 11:23 am, Marcel Müller <news.5.ma...@spamgourmet.org>
wrote:
> D-Dog wrote:
> > bool operator==(testFile &val) {
> > return(data == val.data);

>
> > }

>
> The signature is wrong. Use:
>
> bool operator==(const testFile &val) const {
>
> > However, when I do the following

>
> > class testFile2 {
> > private:

>
> > std::vector< testFile<{some-data-type}> > testThis;

>
> > public:

>
> > bool operator==(testFile2 &this_test) {
> > return(testThis == this_test.testThis);
> > }

>
> Same here, but vector depend on correct signature.
>
> Marcel


Won't using a const lead to a "discards qualifier" error when trying
to compile?
  Réponse avec citation
 
Page generated in 0,05743 seconds with 9 queries