Le_Forgeron <jgr### [at] free fr> wrote:
> Le 13/10/2012 20:38, Warp nous fit lire :
> > Le_Forgeron <jgr### [at] free fr> wrote:
> >> Vector & operator +(const Vector &v2) const
> >> {
> >> return Vector(
> >> this.internal_storage[0]+v2.internal_storage[0],
> >> this.internal_storage[1]+v2.internal_storage[1],
> >> this.internal_storage[2]+v2.internal_storage[2] );
> >> }
> >
> > You are returning a reference to a temporary. Kaboom.
> >
> Yes. I do not know why I did that (nor put a space before the +).
Or use "this." instead of "this->". (Or using "this" in the first place...)
--
- Warp
Post a reply to this message
|