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,530 of 33,346    |
|    Ivan Godard to All    |
|    Re: How to default an undefined operatio    |
|    05 Sep 12 16:51:30    |
      From: igodard@pacbell.net              On 9/5/2012 1:17 PM, Daniel Krügler wrote:       > Am 05.09.2012 20:15, schrieb Daniel Krügler:       >> There are several approaches possible. E.g. you could define a helper       >> traits that evaluates to true, if the expression decltype(U() - U())       >> is well-formed. In this case, you use the specialization that computes       >> the difference type from this decltype, otherwise you would fallback       >> to your version that has a default difference type (or uses other       >> means to compute it).       >       > Here is an example of a possible approach. Within this example I also       > branch for scoped enums and return the underlying type instead (It is       > important that both specializations are mutually exclusive because none       > is more specialized than the other):       >               |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca