Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / outcome / doc / src / content / reference / traits / is_error_code_available.md
1 +++
2 title = "`is_error_code_available<T>`"
3 description = "True if an error code can be constructed from a `T`."
4 +++
5
6 `::value` is true if an error code can be constructed from a `T` e.g. if there exists an ADL discovered free function `make_error_code(T)`.
7 `::type` is the type that would result if `::value` is true, else `void`.
8
9 *Overridable*: By template specialisation into the `trait` namespace.
10
11 *Default*: True if `T` is an error code, else to metaprogramming which performs the ADL discovery of `make_error_code(T)`. Note that the STL defines multiple overloads of an ADL discovered free function {{% api "std::make_error_code(T)" %}} for its error enumerations, as does Boost.System for the Boost error enumerations. Thus this trait will pick up those free functions for those error types.
12
13 *Namespace*: `BOOST_OUTCOME_V2_NAMESPACE::trait`
14
15 *Header*: `<boost/outcome/trait.hpp>`
16
17 *Variable alias*: `is_error_code_available_v<T>`