对象参数规格 [英] Object in parameter specification
本文介绍了对象参数规格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么这句话是有效的在C ++?
Why this sentence is valid in C++?
qi::rule<Iterator, std::string(), skipper<Iterator> > name;
从这里提取:
- Boost::spirit::qi - mini C compiler tutorial - function.hpp
规则的定义(续)以下内容:
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
};
从这里提取:
- rule.hpp file
规则定义需要一个类型,但是我把它的对象。这是可能的吗?
The rule definition expects a type, however I send it an object. It is possible?
推荐答案
在此背景下,的std ::字符串()
表示返回<$的东西类型C $ C>的std ::字符串并没有参数。例如,
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"; }
或的实例
struct Foo
{
std::string operator()() const { return "Foo!\n"; }
};
这篇关于对象参数规格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文