![]() |
Home | Libraries | People | FAQ | More |
boost::algorithm::iterator_range — iterator_range class
template<typename IteratorT> class iterator_range { public: // types typedef iterator_range< IteratorT > type; // this type typedef unspecified value_type; // Encapsulated value type. typedef unspecified reference; // Reference type. typedef unspecified difference_type; // Difference type. typedef unspecified size_type; // Size type. typedef IteratorT const_iterator; // const_iterator type typedef IteratorT iterator; // iterator type typedef iterator(iterator_range::* unspecified_bool_type; // Safe bool conversion. // construct/copy/destruct iterator_range(); iterator_range(iterator, iterator); iterator_range(const std::pair< IteratorT, IteratorT > &); iterator_range(const iterator_range &); template<typename OtherItT> iterator_range(const iterator_range< OtherItT > &); iterator_range& operator=(const iterator_range &); template<typename OtherItT> iterator_range& operator=(const iterator_range< OtherItT > &); // public member functions template<typename OtherItT> bool operator==(const iterator_range< OtherItT > &) const; template<typename OtherItT> bool operator!=(const iterator_range< OtherItT > &) const; IteratorT begin() const; IteratorT end() const; bool empty() const; difference_type size() const; void swap(iterator_range &) ; operator unspecified_bool_type() const; };
An iterator_range delimits a range in a sequence by beginning and ending iterators. An iterator_range can be passed to an algorithm which requires a sequence as an input. For example, the toupper() function may most frequently be used on strings, but can also be used on iterator_ranges:
boost::tolower( find( s, "UPPERCASE STRING" ) );
Many algorithms working with sequences take a pair of iterators, delimiting a working range, as arguments. The iterator_range class is an encapsulation of a range identified by a pair of iterators. It provides a collection interface, so it is possible to pass an instance to an algorithm requiring a collection as an input.
iterator_range();
iterator_range(iterator Begin, iterator End);
iterator_range(const std::pair< IteratorT, IteratorT > & Range);
iterator_range(const iterator_range & Other);
template<typename OtherItT> iterator_range(const iterator_range< OtherItT > & Other);
This constructor is provided to allow conversion between const and mutable iterator instances of this class template
iterator_range& operator=(const iterator_range & Other);
template<typename OtherItT> iterator_range& operator=(const iterator_range< OtherItT > & Other);
template<typename OtherItT> bool operator==(const iterator_range< OtherItT > & Other) const;
Compare operands for equality
template<typename OtherItT> bool operator!=(const iterator_range< OtherItT > & Other) const;
Compare operands for non-equality
IteratorT begin() const;
Retrieve the begin iterator
IteratorT end() const;
Retrieve the end iterator
bool empty() const;
Test whether the range is empty
difference_type size() const;
Retrieve the size of the range
void swap(iterator_range & Other) ;
Swap two ranges
operator unspecified_bool_type() const;
Copyright © 2002-2004 Pavol Droba |