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,758 of 33,346    |
|    Andrey Tarasevich to Paul D. DeRocco    |
|    Re: Pointer to function returning itself    |
|    20 Dec 12 21:43:10    |
      From: andreytarasevich@this.is.invalid              On 12/17/2012 9:06 PM, Paul D. DeRocco wrote:       >       > How do I declare a typedef for a pointer to a function that returns       > itself, meaning a pointer to another function of the same type?              There's no way to express such a type through the concepts used in       C/C++ type description system. Within that system this type infinitely       recursive. For this reason, any attempts to search for the proper       syntax are guaranteed to be doomed. It cannot possibly exist.              They only way to break the recursion is to go through the proverbial       "extra level of indirection" (not literal in this case),       i.e. introduce an extra intermediate type `T`, so that the function       returns `T` and then `T` transforms to a pointer to the function. And       this is exactly how the aforementioned GotW entry does it.              --       Best regards,       Andrey Tarasevich                      [ 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