GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — std::operator== - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. iterator
  3. reverse_iterator
  4. operator==

最終更新日時: 2026年08月27日 11時21分44秒 (JST)
Akira Takahashi が更新

履歴 編集

function template
<iterator>

std::operator==

namespace std {
  template <class Iterator1, class Iterator2>
  bool operator==(const reverse_iterator<Iterator1>& x,
                  const reverse_iterator<Iterator2>& y);           // (1) C++98

  template <class Iterator1, class Iterator2>
  constexpr bool operator==(const reverse_iterator<Iterator1>& x,
                            const reverse_iterator<Iterator2>& y); // (1) C++17
}

概要

2つのreverse_iteratorオブジェクトが同じ要素を指しているかを判定する。

テンプレートパラメータ制約

x.current == y.currentが有効であり、戻り値がboolに変換可能であること。

戻り値

x.current == y.current

例

#include <iostream>
#include <vector>
#include <iterator>

int main()
{
  std::vector<int> v = {1, 2, 3};

  std::reverse_iterator<decltype(v)::iterator> it1(v.end());
  std::reverse_iterator<decltype(v)::iterator> it2(v.end());

  if (it1 == it2) {
    std::cout << "equal" << std::endl;
  }
  else {
    std::cout << "not equal" << std::endl;
  }
}

出力

equal

参照

  • P0031R0 A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access
  • P0896R4 The One Ranges Proposal (was Merging the Ranges TS)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.