Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-10-08 03:50:26


Marco Costalba wrote:

> IOW I see operator=() more naturally used between a variable and a
> value or another variable of the same type, not to add elements to,
> say, a vector.
>
> std::vector<int> v;
> v = 3;
> v = 10;
> v = 7;
>
> Strange!

Not so fast:

     std::string s;
     s = 'x';
     s == 'x'; // ooops can't do

Again that "overloads" uses a tuple is an implementation detail.

Ok, I don't want to beat this to death. Hmm... ok since we are
dealing with an overload set. Perhaps a "set" is a good description
of this. So perhaps "add" is not that bad after all (Johan must be
smiling :-) ). Or perhaps, the union operator |= might also be
a good candidate.

I'll leave it up to you guys, your intuitions are fine and cool! :-)

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk