Le 05/06/2017 à 16:46, Peter Dimov via Boost a écrit :
Vicente J. Botet Escriba wrote:
Oh, in this case it is clear that result<T> is not enough. We need expected
where filesystem:error contains the error_code and the path.
I don't find this particularly appealing, because the whole point of std::error_code was to avoid the need for each library to define separate error classes. expected
will work, I'd just not be willing to recommend it as a general solution. Something like Niall's new outcome<T> that stores both an error_code and an exception seems better, because you can use a single common return type in all libraries. Let define filesystem::error as we consider is the more pertinent. You don't need a specific expected/outcome/xxxxx class to cover this case. Do you?
Vicente