|
![](/i/fill.gif) |
In article <4038f726@news.povray.org>, Darren New <dne### [at] san rr com>
wrote:
> Warp wrote:
> > Int foo = container.size(); // <- gets a *reference*
> > foo -= 100; // Ooops! The container breaks badly!
>
> In this case, you'd make the -= operator return a new reference to be
> assigned to foo.
You make the initial = create a copy. The actual copy operation may be
done later, in the -= (copy on write), but from the point of view of the
user of the code, the -= operator should modify the value of the object
on the left hand side, not create a new one.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tag povray org>
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |