home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,015 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: sharing std::shared_ptr<> deleters   
   15 Mar 12 23:30:46   
   
   fb2d5e4b   
   From: daniel.kruegler@googlemail.com   
      
   Am 15.03.2012 22:58, schrieb Luc Hermitte:   
   > I'm perfectly aware that the deleter passed to a standard shared_ptr   
   > is copied on construction of the first shared_ptr.   
   >   
   > But afterwards, what is happening ?   
   > Can we assume the actual deleter (which can be fetched with   
   > get_deleter) is shared among all copies of the shared_ptr ?   
      
   Yes.   
      
   > When I read §20.7.2.2.10/1,   
   >> get_deleter   
   >> 1 [...] /The returned pointer remains valid as long as there exists a   
   shared_ptr instance that owns d/   
   > the best way I see to fulfil this requirement is to store one unique   
   > (and shared) deleter along with the pointer stored.   
   > Am I wrong to assume this ?   
      
   No.   
      
   Another data point can be found in [util.smartptr.shared.const] for the   
   constructors that allow setting a deleter, namely p. 9:   
      
   "Constructs a shared_ptr object that /owns/ the object p and the deleter d."   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca