Navigation :
Prerequisites
Build and install
Review of Error Handling Frameworks
Motivation
Future ABI stability guarantees
Tutorial
Recipes
Experimental
- The main advantages
- Approximate map between error code designs
- Major differences
- `status_result` and `status_outcome`
-
Worked example: Custom domain
-- Define a custom code domain
-- The payload
-- The constructor
-- String refs
-- Redefining `message()`
-- Constexpr domain source
-- Implicit conversion
- Tying it all together
-
Using Outcome from C code
API reference
Frequently asked questions
Videos
Changelog
History
Constexpr domain source
Back in The constructor , we
declared but did not implement a .get()
function which returns a constexpr static
instance of the domain. We implement this now:
// 100% constexpr instantiation
constexpr _file_io_error_domain file_io_error_domain ;
inline constexpr const _file_io_error_domain & _file_io_error_domain :: get ()
{
return file_io_error_domain ;
}
View this code on Github
As this is 100% constexpr, it can be (and is under optimisation) implemented entirely
in the mind of the compiler with no run time representation.