POV-Ray : Newsgroups : povray.off-topic : Coding in the mainstream : Re: Coding in the mainstream Server Time
29 Jul 2024 04:25:48 EDT (-0400)
  Re: Coding in the mainstream  
From: Warp
Date: 7 Jun 2012 10:35:52
Message: <4fd0bc48@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> The only caveat not explicitly warned about in the smart pointers 
> documentation is that the smart pointer assignment operator ("=") is 
> implemented as a swap operation, so to create another smart pointer 
> referencing the same object you need to explicitly make use of the smart 
> pointers' copy constructor:

That makes no sense. It would break basically everything if it were like
that.

You are confusing it with how operator= of some versions of shared_ptr might
be implemented, in that it internally swaps its contents with a temporary
that has been initialized with the parameter (this is done to avoid problems
that would happen when assigning to itself). Externally there's no swapping
behavior (and there can't be).

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.