I have been going through the boost::range library and noticed boost::range_iterator and boost::iterator_range. I am confused with these terms here. Could anyone please explain what is the difference between two and when to use what? Also, it would be nice if you can point me to sample examples where the boost range library is used to know more about it apart from the documentation.
I have been going through the boost::range library and noticed boost::range_iterator and boost::iterator_range .
Share
range_iterator is used for get type of range iterator in following way:
It simillar in something to std::iterator_traits. For instance, you may get value type from iterator:
iterator_range is bridge between ranges and iterators. For instance – you have pair of iterators, and you want pass them to algorithm which only accepts ranges. In that case you can wrap your iterators into range, using iterator_range. Or better – make_iterator_range – it will help to deduce types (like std::make_pair does):
returns range.
Consider following example:
live demo
For quick summary – check this slides