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,524 of 33,346    |
|    Ivan Godard to All    |
|    How to default an undefined operation?    |
|    05 Sep 12 00:48:44    |
      From: igodard@pacbell.net              I have a template class taking a typename T argument, and need to define       a differenceType representing the abstract "distance" between any pair       of values. The template is instantiated with enums, built-in types, and       random user classes that define operator-(T, T). This difference type       was initially declared as:        typedef typeof(T() - T()) differenceType;              I recently converted an existing enum to a C++11 "enum class", and the       above broke because operator- was not defined for enum classes and there       is no conversion to something that defines it.              I want to leave the above for everything that it works for, and for       everything else (including enum classes) use the signed type of the same       size as the argument. I tried:              template |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca