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,263 of 33,346   
   Pete Becker to Peter   
   Re: How to convert a typedef to a std::f   
   09 May 12 15:02:09   
   
   a3d66e46   
   From: pete@versatilecoding.com   
      
   On 2012-05-09 19:27:34 +0000, Peter said:   
      
   > Hi Folks,   
   >   
   > given this typedef   
   >   
   > typedef bool (*on_hit_test_type)(widget_interactive *, point const*,   
   > bool *);   
   >   
   > and this member definition   
   >   
   > std::function   
   > on_hit_test;   
   >   
   > Is there a way to convert one to the other? (The typedef to the   
   > std::function template argument or the other way round)   
   >   
   > The reason I'm asking is that I have a ton of them, and it's easy to   
   > make errors in these somwhat duplicate constructs.   
   >   
   > Ideally, I'd like to write one and derive the other somehow from it.   
   >   
      
   typedef int func(double);   
   typedef func *fptr;   
   std::function …   
      
   --   
    Pete   
   Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The   
   Standard C++ Library Extensions: a Tutorial and Reference   
   (www.petebecker.com/tr1book)   
      
      
         [ 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