5b35552d   
   From: dave@boostpro.com   
      
   on Tue Nov 22 2011, Andrzej KrzemieĊski wrote:   
      
   > Hi,   
   > I am trying to implement a template "wrapper" for any arbitrary type,   
   > much like boost::optional. In fact I am trying to write my own   
   > alternative implementation of optional. I want it to have the   
   > following property: if the wrapped type T ptovides copy constructor,   
   > optional also provides a copy constructor; similarly, optional   
   > provides a move constructor iff T provides one. With concepts (as   
   > defined in N2914), I would express it like this:   
   >   
   > template< typename T >   
   > struct Optional   
   > {   
   > requires CopyConstructible   
   > Optional( Optional const& );   
   >   
   > requires MoveConstructible   
   > Optional( Optional && );   
   > };   
   >   
   > Do you know of any way to implement similar behavior in C++11? The   
   > enable_if trick does not seem to work for disabling the default   
   > constructor.   
      
   I think you might need to dispatch to different specializations of the   
   whole class template based on the properties of T.   
      
   --   
   Dave Abrahams   
   BoostPro Computing   
   http://www.boostpro.com   
      
      
    [ 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)   
|