![]() |
boost::taar::handler::rest_arg_cast — Cast a REST argument from FromType to ToType.
// In header: <boost/taar/handler/rest_arg_cast.hpp> template<typename ToType, typename FromType> constexpr decltype(auto) rest_arg_cast(FromType const & from);
Resolution order:
A user-defined tag_invoke(rest_arg_cast_tag<ToType>, ...) overload found by ADL takes precedence.
Otherwise a built-in conversion is selected. Built-ins cover identity, implicit conversions, string-to-bool ("true", "yes", "1"), string-to-number (via std::from_chars), number-to-string (via std::to_chars), boost::json::value to any value_to-compatible type, and CSV-style string to container.
The built-in conversions throw boost::taar::exception with a boost::taar::error code (invalid_number_format, invalid_boolean_format) and the offending text in the failure's message. User-defined conversions may throw anything; the argument binder wraps it.