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,607 of 33,346   
   Martin Ba to curently Unemployed   
   Re: Proposing automatic move in static a   
   25 Oct 12 11:07:52   
   
   From: 0xcdcdcdcd@gmx.at   
      
   On 25.09.2012 16:35, curently Unemployed wrote:   
   >   
   > Skyscrapper city[1000];                         // instead of temp   
   > city[1] = Skyscrapper("Empire State Building"); // compiller should use   
   >                                                   // &city[1] as this pointer   
   >   
   > This would fix heap and static(which && can't) waste = zero   
   > alloc/copy.  Majority of objects are small thus majority of their   
   > memory is static.   
   >   
   > ...After all those attempts to store anything via = without waste I   
   > think that compiller should do "placement new" transparently in this   
   > particular case.  Instead of forcing us to implement zillion &&   
   > operators that solve only heap side of problem. ...   
      
   Hmm, wouldn't it be possible to solve this with a variant of std::array   
   that doen't call the default ctor's for it's underlying type?   
      
   Something like   
      
     my::uninitialized_array city;   
     // Accessing any element value before constructing it would be UB   
     new (&city[1]) Skyscrapper("Empire State Building");   
      
   and voilą.   
      
   Is that implementable?   
      
   cheers,   
   Martin   
      
      
   --   
         [ 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