Boost C++ 库

“...世界上最受推崇和精心设计的 C++ 库项目之一。” Herb SutterAndrei Alexandrescu, C++ 编码标准

PrevUpHomeNext

结构体模板 child

boost::proto::functional::child — 一个可调用的 多态函数对象 (PolymorphicFunctionObject),等价于 proto::child() 函数。

概要

// In header: <boost/proto/traits.hpp>

template<typename N = mpl::long_<0> > 
struct child :  proto::callable {
  // member classes/structs/unions
  template<typename This, typename Expr> 
  struct result<This(Expr)> :  proto::result_of::child< Expr, N > {
  };

  // public member functions
  template<typename Expr> 
    typename proto::result_of::child< Expr &, N >::type 
    operator()(Expr &) const;
  template<typename Expr> 
    typename proto::result_of::child< Expr const &, N >::type 
    operator()(Expr const &) const;
};

描述

一个可调用的 多态函数对象 (PolymorphicFunctionObject),等价于 proto::child() 函数。 N 必须是 MPL 整数常量。

child 公有成员函数

  1. template<typename Expr> 
      typename proto::result_of::child< Expr &, N >::type 
      operator()(Expr & expr) const;

    返回给定表达式的第 Nth 个子节点。

    参数

    expr

    表达式节点。

    要求

    proto::is_expr<Expr>::valuetrue

    N::value < Expr::proto_arity::value

    返回值

    proto::child<N>(expr)

    抛出

    不会抛出异常。
  2. template<typename Expr> 
      typename proto::result_of::child< Expr const &, N >::type 
      operator()(Expr const & expr) const;

    这是一个重载的成员函数,为了方便起见而提供。它与上面的函数唯一的不同之处在于它接受的参数。


PrevUpHomeNext