I saw std::result_of
is being deprecated in C++17.
std::result_of
deprecated in C++17?std::result_of
and std::invoke_result
.Along with the new features added to the language and the standard library in C++17, there are also existing features that have been either removed (after being deprecated in a previous version) or deprecated so they would be removed sometime in the future.
Result<T, E> is a template type that can be used to return and propage errors. It can be used to replace exceptions in context where they are not allowed or too slow to be used.
T.C. already provided the obvious link, but perhaps the most horrific reason bears repeating: result_of
involved forming the type F(Arg1, Arg2, ...)
not for a function of those types returning F
but for a function of type F
accepting those types. (After all, the return type is the result of, well, result_of
, not the input!)
Aside from the adjustments associated with forming the function type, the only difference between the two is syntactic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With