[#unless_error] [section unless_error] [h1 Synopsis] template struct unless_error; This is a [link lazy_metafunction lazy template metafunction]. [table Arguments [[Name] [Type]] [[`T`] [[link accept accept] or [link reject reject] value]] [[`NotErrorCase`] [[link metaprogramming_value template metaprogramming value]]] ] [h1 Description] Checks if `T` is a parsing error or not. When it is, the result is `T`. When it is not, the result is `NotErrorCase`. [h1 Header] #include [h1 Expression semantics] For any `t` and `c` classes the following are equivalent: unless_error boost::mpl::if_::type, t, c> [h1 Example] #include #include #include #include #include #include #include using namespace boost::metaparse; BOOST_METAPARSE_DEFINE_ERROR(sample_error, "Sample error message"); using accept1 = accept, BOOST_METAPARSE_STRING("foo"), start>; using accept2 = accept, BOOST_METAPARSE_STRING("bar"), start>; using reject1 = reject; struct returns_accept1 { using type = accept1; }; struct returns_accept2 { using type = accept2; }; static_assert( std::is_same::type>::type::value, "it returns the second argument when the first argument is an accept" ); static_assert( std::is_same::type>::type::value, "it returns the first argument when that is a reject" ); static_assert( std::is_same< accept2, unless_error::type >::type::value, "it supports lazy evaluation" ); [endsect]