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,143 of 33,346   
   Edward Diener to All   
   Different syntax for shared arrays betwe   
   14 Apr 12 23:29:47   
   
   From: eldiener@tropicsoft.invalid   
      
   As I understand it specifying a non-shared array with unique_ptr is   
   done using the syntax:   
      
   std::unique_ptr up(new T[n]);   
      
   The unique_ptr has a partial specialization to handle this.   
      
   The syntax for handling shared arrays with shared_ptr is different:   
      
   std::shared_ptr sp(new T[n],std::default_delete());   
      
   Why is the syntax for working with arrays in unique_ptr and shared_ptr   
   different ?   
      
      
   --   
         [ 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