public member function
<set>

std::multiset::crbegin

const_reverse_iterator crbegin() const noexcept;
返回指向反向起始位置的 const_reverse_iterator
返回一個const_reverse_iteratorpointing to the last element in the container (i.e., its reverse beginning).

引數



返回值

Aconst_reverse_iteratorto the reverse beginning of the sequence.

成員型別const_reverse_iterator是一個指向 const 元素的 雙向迭代器 型別。

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// multiset::crbegin/crend
#include <iostream>
#include <set>

int main ()
{
  std::multiset<int> mymultiset = {10,20,30,20,10};

  std::cout << "mymultiset backwards:";
  for (auto rit=mymultiset.crbegin(); rit != mymultiset.crend(); ++rit)
    std::cout << ' ' << *rit;

  std::cout << '\n';

  return 0;
}

輸出
mymultiset backwards: 30 20 20 10 10


複雜度

常量。

迭代器有效性

沒有變化。

資料競爭

訪問容器。
同時訪問 multiset 的元素是安全的。

異常安全

無異常保證:此成員函式從不丟擲異常。
還可以保證返回的迭代器的複製構造或賦值永遠不會引發異常。

另見