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,671 of 33,346   
   Zhihao Yuan to Cassio Neri   
   Re: Does a template class class built on   
   21 Nov 12 23:48:15   
   
   From: lichray@googlemail.com   
      
   On Wednesday, November 21, 2012 5:43:19 PM UTC-6, Cassio Neri wrote:   
   > foo seen above). However, T is unknown in advance. The question is:   
   > can I be sure that foo has the same layout as T[N]?   
      
   No, very sad (10 p.5, p.6, p.8), the base class subobjects can   
   have different physical order from their order appears in the base   
   specifier list.   
      
   However, since member subobject, base class subobject, array element   
   are all considered as subojects (1.8 p.2), they have the same   
   alignment requirements.  More important, they are initialized in   
   their order appears in the base specifier list, and destructed in   
   the reverse order.  So, your intention can be meet, if you don't care   
   about the physical ordering.   
      
   std::tuple uses the technique you showed, but std::array does not.   
      
      
   --   
         [ 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