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,478 of 33,346   
   Kaba to Kaba   
   Re: Layered data structures   
   14 Jul 12 06:41:22   
   
   From: kaba@nowhere.com   
      
   14.7.2012 3:23, Kaba wrote:   
   > ### Option 3: Transferred ownership   
   >   
   > In this option A is moved into B. This guarantees that B can not be   
   > modified or destructed, as long as A exists and refers to B.  The A   
   > can release the ownership of B to outside, given that it also clears   
   > its state. The problem with this approach is that there can be only   
   > one data structure B which can refer to A.   
      
   Clearly there is an error here, since I had the roles of A and B   
   reversed. It should have been:   
      
   ### Option 3: Transferred ownership   
      
   In this option A is moved into B. This guarantees that A can not be   
   modified or destructed, as long as B exists and refers to A.  The B   
   can release the ownership of A to outside, given that it also clears   
   its state. The problem with this approach is that there can be only   
   one data structure B which can refer to A.   
      
   I will also add:   
      
   ### Option 5: Locking   
      
   In this option B notifies A that it is being referred to. In each   
   mutating operation of A, or when destructing A, A checks whether it is   
   being referred to. If this is the case, an error is generated at   
   run-time.   
      
   --   
   http://kaba.hilvi.org   
      
      
      
         [ 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