at 構造体テンプレート

struct op::at

at<> は、シーケンスに添字アクセスする PolymorphicFunctionObject である。

概要

// ヘッダ:<boost/xpressive/regex_actions.hpp>

struct at {
  // メンバクラス、構造体、共用体
  template<typename Sig>
  struct result {
  };
  template<typename This, typename Cont, typename Idx>
  struct result<This(Cont &, Idx)> {
    // 型
    typedef Cont::reference type;
  };
  template<typename This, typename Cont, typename Idx>
  struct result<This(Cont const &, Idx)> {
    // 型
    typedef Cont::const_reference type;
  };
  template<typename This, typename Cont, typename Idx>
  struct result<This(Cont, Idx)> {
    // 型
    typedef Cont::const_reference type;
  };

  // 公開メンバ関数
  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 公開メンバ関数

template<typename Cont, typename Idx>
Cont::reference operator()(Cont &c, Idx idx) const
パラメータ
  • c -- 添字アクセスする RandomAccessSequence

  • idx -- 添字

要件

Cont が RandomAccessSequence のモデルである

戻り値

c[idx]

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

利便性のためのメンバ関数多重定義。上記関数と受け取る引数が異なるのみ。