<p>I'd like to compare two consecutive elements in a std::list while iterating through the list. What is the proper way to access element i+1 while my iterator is at element i?
Thanks
Cobe</p>

Boost has a utility called
```
next
```
(and its inverse,
```
prior
```
) for just that purpose.
```
```
*itr == *next(itr)
```
```
Edit: But, if we step back to look at the forest, the
real
question is, why custom-write your
```
adjacent_find
```
function? (I recommend Nicola Bonelli's answer to be accepted.) That's part of the STL, and doesn't require using Boost, if your code doesn't use Boost (thanks to the commenters for pointing this out).