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,999 of 33,346   
   Dave Harris to Francis Glassborow   
   Re: want to pass vector to fn expe   
   24 Apr 13 15:06:06   
   
   From: brangdonj@googlemail.com   
      
   In article <6t2dnURZG_3cX-7MnZ2dnUVZ8gadnZ2d@bt.com>,   
   francis.glassborow@btinternet.com (Francis Glassborow) wrote:   
   > The problem is actually unrelated to issues with the safety of the   
   > type system. The problem is with templates. These create unrelated   
   > types. So there is no relationship in so far as the language   
   >  specification is concerned, between   
   > std::vector  and std::vector   
   >   
   > I am at a loss to see how we could specify such a relationship   
   > without, at the same time, introducing a great gaping hole in   
   > the type system.   
      
   As I understand it, we want the effect of something like:   
      
       vector::operator vector &() const {   
           return *(vector *)this;   
       }   
      
   Achieving this would be a matter of using pointer_traits to turn   
    into  and then using enable_if to disable the   
   operator when T is not a non-const pointer. Am I missing something?   
      
      
   -- Dave Harris, Nottingham, UK.   
      
      
   --   
         [ 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