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 31,488 of 33,346   
   =?windows-1252?Q?Daniel_Kr=FCgler?= to All   
   Re: Cast from shared_ptr* to shared_p   
   24 Sep 11 14:48:52   
   
   From: daniel.kruegler@googlemail.com   
      
   Am 24.09.2011 12:48, schrieb Daniel Krügler:   
   > Am 23.09.2011 21:03, schrieb Thiago Adams:   
   >> Hi,   
   >>   
   >> I understand that the types shared_ptr and shared_ptr   
   >> are independent types.   
   >   
   > It is of little importance, whether both types are independent or not   
   > for the question that you are asking here (at least if I understand your   
   > question correctly). It seems to me that you want to reinterpret a   
   > reference or a pointer to shared_ptr as shared_ptr. This   
   > requires a property called "layout-compatible", see 9.2 p19+20:   
      
   I must correct me here: Layout-compatible is not sufficient in C++ (I   
   think it is sufficient in C), the provided guarantees are not sufficient   
   for your purpose. We would need 3.10 p10 ("If a program attempts to   
   access the stored value of an object through a glvalue of other than one   
   of the following types[..]") for this purpose. But the bulleted list   
   does not fit to shared_ptr versus shared_ptr. This means my   
   assumed hesitation about implementors providing this guarantee could be   
   worse as I described.   
      
   I apologize for any confusion,   
      
   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