Reputation: 12259
Why this sentence is valid in C++?
qi::rule<Iterator, std::string(), skipper<Iterator> > name;
Extracted from here:
The definition of rule is (resumed) the following:
template <typename Iterator, typename T1, typename T2,
typename T3, typename T4>
struct rule : boost::proto::extends<bla, bla>, parser<bla, bla>
{
bla, bla
};
Extracted from here:
The rule definition expects a type, however I send it an object. It is possible?
Upvotes: 3
Views: 113
Reputation: 227390
In this context, std::string()
means the type of something that returns an std::string
and has no parameters. For example,
std::string foo() { return "Foo!\n"; }
or an instance of
struct Foo
{
std::string operator()() const { return "Foo!\n"; }
};
Upvotes: 3
Reputation: 110658
You don't give it an object. std::string()
is the type of a function that takes no arguments and returns an std::string
.
Upvotes: 3