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,449 of 33,346   
   Johannes Schaub to Alok   
   Re: C++ Templates: The complete Guide in   
   04 Sep 11 15:37:17   
   
   1ebc204a   
   From: schaub.johannes@googlemail.com   
      
   Alok wrote:   
      
   > I was just wondering, How far does the book:   
   >   
   > C++ Templates: The complete Guide   
   > by David Vandevoorde & Nicolai Josutils,   
   >   
   > hold good in context of the the new C++11 standard? What are the   
   > relevant areas which will need an update, or don't hold good anymore   
   > within the modifications that will come through in C++11?   
   >   
      
   It would be good to extend it with alias templates and the new   
   enumerations,   
   including those defined out-of-class:   
      
        template   
        struct A {   
          enum B : int;   
        };   
      
        template   
        enum A::B : int {   
          X, Y, Z   
        };   
      
   In this case, we introduced members X, Y and Z into class "A" after its   
   complete body has been seen, which is something completely new in C++11.   
   This adds some new complications, like what happens if you name "A::X"   
   before the definition of B has been seen and what happens to a scoped   
   enumeration's enumerators when the enclosing class is implicitly   
   instantiated:   
      
        template   
        struct A {   
          enum class B { X = sizeof(T) };   
        };   
      
        A a;   
      
   C++11 specifies that instantiation of "X" is not done in this example, such   
   that this code is well-formed.   
      
      
   --   
         [ 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