共用方式為


multiset::crend

Returns a const iterator that addresses the location succeeding the last element in a reversed multiset.

const_reverse_iterator crend( ) const;

Return Value

A const reverse bidirectional iterator that addresses the location succeeding the last element in a reversed multiset (the location that had preceded the first element in the unreversed multiset).

Remarks

crend is used with a reversed multiset just as end is used with a multiset.

With the return value of crend, the multiset object cannot be modified.

crend can be used to test to whether a reverse iterator has reached the end of its multiset.

The value returned by crend should not be dereferenced.

Example

// multiset_crend.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main() {
   using namespace std;   
   multiset <int> ms1;
   multiset <int>::const_reverse_iterator ms1_crIter;

   ms1.insert( 10 );
   ms1.insert( 20 );
   ms1.insert( 30 );

   ms1_crIter = ms1.crend( ) ;
   ms1_crIter--;
   cout << "The last element in the reversed multiset is "
        << *ms1_crIter << "." << endl;
}

Output

The last element in the reversed multiset is 10.

Requirements

Header: <set>

Namespace: std

See Also

Reference

multiset Class

Standard Template Library