POV-Ray : Newsgroups : povray.off-topic : Adventures with C++ : Re: An actual C++ question Server Time
29 Jul 2024 00:28:55 EDT (-0400)
  Re: An actual C++ question  
From: Orchid Win7 v1
Date: 16 May 2013 03:39:25
Message: <51948d2d$1@news.povray.org>
>>      class PrivateClass;
>
>>      class MyClass
>>      {
>>          std::shared_ptr<PrivateClass>  privateObject;
>>      };

OK. That seems easy enough.

> Oh, and take into account that if instances of MyClass are copied around,
> the copies will share the one and same PrivateClass object. That will not
> get deep-copied. (That's what the "shared ptr" means, actually.)

There "should" only ever be one instance of this class; I'd just like to 
avoid the program exploding if somebody *does* copy that instance for 
some reason. A shallow copy is acceptable.


Post a reply to this message

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