Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Aokison committed Jun 5, 2021
2 parents 9d730b2 + 9f8902a commit 0445aa1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions set/crend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# crend

**Description :**
This method is used to return a const_reverse_iterator pointing to the position preceding the first element of the container. This is useful
when wanting a read-only iterator to iterate a container in reverse order.

**Example :**
```cpp
//Run Code To Demonstrate use of set.crend()
#include<iostream>
#include<set>

int main() {
// Create a set object holding integers
std::set<int> myset{ 2, 4, 3, 5, 1 };

// Iterate through the const_reverse_iterator
std::cout << "myset reversed:";
for (auto r_it = myset.crbegin(); r_it != myset.crend(); ++r_it){
std::cout << ' ' << *r_it;
}

return 0;
}

```

**[Run Code](https://rextester.com/YAWBA53642)**

0 comments on commit 0445aa1

Please sign in to comment.