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 31,451 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: Covariant return types and interdepe    |
|    05 Sep 11 15:22:19    |
      0b60190a       From: daniel.kruegler@googlemail.com              Am 31.08.2011 14:52, schrieb Javier:       > I'm having a problem trying to get two classes that refer to each       > other take a covariant return type. While this is occurring in the       > Visual C++ 2010 compiler (and I'm posting a modified version here of       > my original post in the C++ forums at MS), I have a more general       > question, namely if there is a way for a compiler to pass what would       > be, in my opinion, valid code for covariant return types, or if I'm at       > the mercy of the compiler vendor :-)              [..]              To solve your problem practically, you could consider to take advantage       of two helper class templates as shown below. This approach uses the NVI       (non-virtual interface) idiom and has other advantages, too (E.g. it is       easy to simulate covariant return types with smart pointers):              #include |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca