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 33,000 of 33,346   
   Francis Glassborow to Jonathan Thornburg   
   Re: want to pass vector to fn expe   
   25 Apr 13 07:29:43   
   
   From: francis.glassborow@btinternet.com   
      
   On 25/04/2013 08:51, Jonathan Thornburg wrote:   
   > Dave Harris  wrote:   
   >> 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?   
   >   
   > This would be perfect.   
   >   
   > If I understand you correctly, this could be implemented by changes   
   > to std::vector alone, i.e., it does NOT require changing the syntax   
   > or semantics of the C++ programming language itself.  Is this   
   > correct?   
   >   
   > A related design question....  As I understand this solution, it   
   > would provide the conversion implicitly.  An alternative would be to   
   > require an explicit static_cast< std::vector > .  Would   
   > this be preferable?  (I don't know -- I'm asking people's opinions.)   
      
   That looks like a 'yesterday' solution. If it can be done like that it   
   would, IMHO. be better to wait for Concepts Lite so that we can   
   provide a future solution.   
      
   Francis   
      
      
   --   
         [ 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