13 Jan
2018
13 Jan
'18
12:20 a.m.
Niall Douglas wrote:
A principled approach would be to ask the category whether a code is `true` or `false`, but that might be complexity and overhead nobody needs.
I think it unavoidable myself (and hardly complex to implement). Only an error category knows if some value or other means success or not.
There would be not much overhead if the category implementation marks the function used final, as I expect it would.
I'm not sure it would matter much in the general case whether the category implementation has marked the function final or not; if the compiler doesn't know the dynamic type of error_code::category(), it would need to issue the virtual call.