Boost C++ 库

...世界上最受推崇和设计精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu,《C++ 编码规范

结构体模板 child_c - Boost C++ 函数库
PrevUpHomeNext

结构体模板 child_c

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

提要

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

template<long N> 
struct child_c :  proto::callable {
  // member classes/structs/unions
  template<typename This, typename Expr> 
  struct result<This(Expr)> :  proto::result_of::child_c< Expr, N > {
  };

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

描述

child_c 公有成员函数

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

    返回给定表达式的第 N 个子元素。

    参数

    expr

    表达式节点。

    要求

    proto::is_expr<Expr>::valuetrue

    N < Expr::proto_arity::value

    返回

    proto::child_c<N>(expr)

    抛出

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

    这是一个重载的成员函数,为方便起见提供。它仅在接受的参数不同时与上述函数有所区别。


PrevUpHomeNext