Quote:Original post by nlbs
But I am not inserting an Item.
Yes, you are. operator[] inserts an item if it does not exist yet, which means that it can potentially change the map. Use it->second instead.
Quote:Original post by nlbs
But I am not inserting an Item.
Quote:Original post by nlbs
cause I want to return a blank const Var()'s reference
Quote:Original post by nlbs
[...]and no if I used return Var(0x0) that was a reference to local variable but
const Var& d(0x0);
return d;
doesnt fire this Error
and as its returning a const Var& is there any other options ??
cause I want to return a blank const Var()'s reference
Quote:Original post by nlbs
But If I use
const Var& d(0x0);
return d;
g++ doesn't throw any warning/error like returning reference to local variable.
Quote:Original post by nlbs
g++ doesn't throw any warning/error like returning reference to local variable.