Boost C++ 库

...世界上最受推崇、设计最精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ Coding Standards

at 结构 - Boost C++ 函数库
PrevUpHomeNext

at 结构

boost::xpressive::op::at — at 是一个 PolymorphicFunctionObject,用于对序列进行索引

提要

// 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

    要进行索引的 RandomAccessSequence

    idx

    索引

    要求

    Cont 是 RandomAccessSequence 的一个模型

    返回

    c[idx]

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

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


PrevUpHomeNext