Boost C++ 库

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

Struct at - Boost C++ 函数库
PrevUpHomeNext

Struct at

boost::xpressive::op::at — at 是一个用于对序列进行索引的多态函数对象

提要

// In header: <boost/xpressive/regex_actions.hpp>


struct at {
  // member classes/structs/unions
  template<typename Sig> 
  struct result {
  };
  template<typename This, typename Cont, typename Idx> 
  struct result<This(Cont &, Idx)> {
    // types
    typedef Cont::reference type;
  };
  template<typename This, typename Cont, typename Idx> 
  struct result<This(Cont const &, Idx)> {
    // types
    typedef Cont::const_reference type;
  };
  template<typename This, typename Cont, typename Idx> 
  struct result<This(Cont, Idx)> {
    // types
    typedef Cont::const_reference type;
  };

  // public member functions
  template<typename Cont, typename Idx> 
    Cont::reference operator()(Cont &, Idx) const;
  template<typename Cont, typename Idx> 
    Cont::const_reference operator()(Cont const &, Idx) const;
};

描述

at 公有成员函数

  1. template<typename Cont, typename Idx> 
      Cont::reference operator()(Cont & c, Idx idx) const;

    参数

    c

    要索引的随机访问序列

    idx

    索引

    要求

    Cont 是随机访问序列的模型

    返回

    c[idx]

  2. template<typename Cont, typename Idx> 
      Cont::const_reference operator()(Cont const & c, Idx idx) const;

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


PrevUpHomeNext