Closed akrzemi1 closed 8 months ago
A sample definition:
template <typename Parser>
using attribute_type = decltype(boost::parser::parse(std::string_view{}, std::declval<Parser>()))::value_type;
char_
's attribute type depends on the input. So that definition is correct as long as the input is always a sequence of char
. But it's possibly (but not always, depending on the exact combination of parsers) wrong if the input is a sequence of char32_t
.
See the rationale section for why I think char_
polymorphism is an important feature.
However, it's really easy to interrogate this yourself at the point of use: decltype(bp::parser(str, p)
.
Docs section Terminology has: "Since it is not possible to write a type trait that returns the attribute type of a parser, we need notation for concisely communicating". But it isnot at all clear why that would be impossible.