Construct an unexpected value, deducing the error type.
Synopsis
Declared in <mrdocs/polyfill/expected.hpp>
template<class E>
constexpr
unexpected<std::remove_cvref_t<E>>
Unexpected(E&& e);
Description
A factory function (not an alias template for unexpected) so callers can write Unexpected(e) and have the error type deduced on every supported compiler; alias‐template CTAD (P1814) is not implemented everywhere (e.g. Clang 18). Defined once here and re‐exported into the mrdocs, dom, and handlebars namespaces via using polyfill::Unexpected;, so every call names this single overload and there is no ADL ambiguity across namespaces. It yields exactly unexpected<E>, which expected recognizes (a derived type would not be, breaking expected<T&>).
Return Value
An unexpected holding the decayed error value.
Parameters
Name |
Description |
e |
The error value to wrap. |
Created with MrDocs