There’s no trick. The attribute type is not std::string
. It’s a function which returns std::string
. Because that’s essentially what a Qi rule is (if you squint hard enough): it’s a function which parses a piece of text and returns the parsed value.
These are just one possible attribute type. Other rules accept values, and consequently are functions which have a parameter:
qi::rule<string::iterator, void(std::string), ascii::space_type> end_tag;
This is an example from the Qi documentation.