Re: cannot erase const instance; bug or feature?



 DEVELOP > c-Plus-Plus > Re: cannot erase const instance; bug or feature?

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1
Topic: DEVELOP > c-Plus-Plus
User: "Karl Heinz Buchegger"
Date: 04 Jul 2003 08:59:30 AM
Object: Re: cannot erase const instance; bug or feature?
Corno wrote:


Hi all,

should the following code compile?

void test(std::set<Thing *> things, Thing * const thing)
{
things.erase(thing);
}

My compiler complains that it cannot convert Thing * const to Thing *, but
why should it need a non const pointer as this instance is not going to be
changed?

Why do you pass the pointer as const at all?
You don't gain anything by doing it.
--
Karl Heinz Buchegger
kbuchegg@gascad.at
.

 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER