读书人

binder2nd类模板的op(_x, value)是什么

发布时间: 2012-06-15 19:37:05 作者: rapoo

binder2nd类模板的op(__x, value)是什么意思啊
template <class _Operation>
class binder2nd: public unary_function<typename _Operation::first_argument_type, typename _Operation::result_type>
{
protected:
_Operation op;
typename _Operation::second_argument_type value;
public:
binder2nd(const _Operation& __x,const typename _Operation::second_argument_type& __y): op(__x), value(__y) {}
typename _Operation::result_type operator()(const typename _Operation::first_argument_type& __x) const
{ return op(__x, value); }

// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 109. Missing binders for non-const sequence elements
typename _Operation::result_type operator()(typename _Operation::first_argument_type& __x) const
{ return op(__x, value); }
};
以上是binder2nd类模板定义,在不同编译器中类型名可能不同,但定义是一样的,其中的一句话op(_x,value)是什么意思啊。我理解op是_Operation类型变量或者对象,但已经定义的变量或者对象后跟括号,括号里也有变量或者对象,就不知道什么意思了。

[解决办法]
函数调用
operator()

读书人网 >C++

热点推荐