Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template iterator_t

boost::segmented_tree::iterator_t

Synopsis

// In header: <boost/segmented_tree/seq.hpp>

template<typename StaticTraits, typename Pointer, typename Reference> 
class iterator_t {
public:
  // types
  typedef std::random_access_iterator_tag         iterator_category;  // The iterator category type. 
  typedef typename static_traits::value_type      value_type;         // The value type. 
  typedef typename static_traits::size_type       size_type;          // The size type. 
  typedef typename static_traits::difference_type difference_type;    // The difference type. 
  typedef Pointer                                 pointer;            // The pointer type. 
  typedef Reference                               reference;          // The iterator reference type. 

  // construct/copy/destruct
  iterator_t(iterator_data);
  iterator_t() = default;
  iterator_t(iterator_t const &) = default;
  template<typename P, typename R, 
           typename  = typename std::enable_if<                std::is_convertible<P, pointer>::value>::type> 
    iterator_t(iterator_t< static_traits, P, R > const &);
  iterator_t & operator=(iterator_t const &) = default;

  // friend functions
  friend iterator_t operator+(difference_type, iterator_t);

  // public member functions
  pointer current() const;
  pointer begin() const;
  pointer end() const;
  pointer operator->() const;
  reference operator*() const;
  reference operator[](difference_type) const;
  iterator_t & operator++();
  iterator_t & operator--();
  iterator_t operator++(int);
  iterator_t operator--(int);
  iterator_t & operator+=(difference_type);
  iterator_t & operator-=(difference_type);
  iterator_t operator+(difference_type) const;
  iterator_t operator-(difference_type) const;
  difference_type operator-(iterator_t const &) const;
  iterator_t & move_before_segment();
  iterator_t & move_before_segment(size_type);
  iterator_t & move_after_segment();
  iterator_t & move_after_segment(size_type);
  iterator_t before_segment() const;
  iterator_t after_segment() const;
  iterator_t before_segment(size_type) const;
  iterator_t after_segment(size_type) const;
  bool operator!=(iterator_t const &) const;
  bool operator==(iterator_t const &) const;
  bool operator<(iterator_t const &) const;
  bool operator>(iterator_t const &) const;
  bool operator<=(iterator_t const &) const;
  bool operator>=(iterator_t const &) const;
};

Description

A template class used for const and non-const iterators for seq.

Template Parameters

  1. typename StaticTraits
  2. typename Pointer

    A const or non-const pointer.

  3. typename Reference

    A const or non-const reference.

iterator_t public construct/copy/destruct

  1. iterator_t(iterator_data it);
  2. iterator_t() = default;

    Effects. Default constructs an iterator from another.

    Complexity. Constant.

  3. iterator_t(iterator_t const & other) = default;

    Effects. Copy constructs an iterator from other.

    Complexity. Constant.

  4. template<typename P, typename R, 
             typename  = typename std::enable_if<                std::is_convertible<P, pointer>::value>::type> 
      iterator_t(iterator_t< static_traits, P, R > const & other);

    Effects. Copy constructs a const iterator from non-const iterator other.

    Complexity. Constant.

  5. iterator_t & operator=(iterator_t const & other) = default;

    Effects. Copy assigns from other.

    Complexity. Constant.

iterator_t friend functions

  1. friend iterator_t operator+(difference_type diff, iterator_t it);

    Returns. A copy of the iterator it moved forward diff elements.

    Complexity. Logarithmic amortized in the absolute value of diff.

iterator_t public member functions

  1. pointer current() const;

    Returns. A pointer to the current element of the current segment of the iterator.

    Complexity. Constant.

    Note. Non-standard extension.

  2. pointer begin() const;

    Returns. A pointer to the first element of the current segment of the iterator.

    Complexity. Constant.

    Note. Non-standard extension.

  3. pointer end() const;

    Returns. A pointer 1 past the last element of the current segment of the iterator.

    Complexity. Constant.

    Note. Non-standard extension.

  4. pointer operator->() const;

    Returns. A pointer to the current element.

    Complexity. Constant.

  5. reference operator*() const;

    Returns. A reference to the current element.

    Complexity. Constant.

  6. reference operator[](difference_type diff) const;

    Returns. A reference to the element diff positions away from the current position.

    Complexity. Logarithmic amortized in the absolute value of diff.

  7. iterator_t & operator++();

    Effects. Move the iterator forward 1 element.

    Returns. A reference to *this.

    Complexity. Constant amortized.

  8. iterator_t & operator--();

    Effects. Move the iterator backward 1 element.

    Returns. A reference to *this.

    Complexity. Constant amortized.

  9. iterator_t operator++(int);

    Returns. A copy of the iterator moved forward 1 element.

    Complexity. Constant amortized.

  10. iterator_t operator--(int);

    Returns. A copy of the iterator moved backward 1 element.

    Complexity. Constant amortized.

  11. iterator_t & operator+=(difference_type diff);

    Effects. Move the iterator forward diff elements.

    Returns. A reference to *this.

    Complexity. Logarithmic amortized in the absolute value of diff.

  12. iterator_t & operator-=(difference_type diff);

    Effects. Move the iterator backward diff elements.

    Returns. A reference to *this.

    Complexity. Logarithmic amortized in the absolute value of diff.

  13. iterator_t operator+(difference_type diff) const;

    Returns. A copy of the iterator moved forward diff elements.

    Complexity. Logarithmic amortized in the absolute value of diff.

  14. iterator_t operator-(difference_type diff) const;

    Returns. A copy of the iterator moved backward diff elements.

    Complexity. Logarithmic amortized in the absolute value of diff.

  15. difference_type operator-(iterator_t const & other) const;

    Returns. A distance between the specified iterator.

    Complexity. Constant.

  16. iterator_t & move_before_segment();

    Effects. Move the iterator to the last element of the previous segment.

    Returns. A reference to *this.

    Complexity. Constant amortized.

    Note. Non-standard extension.

  17. iterator_t & move_before_segment(size_type count);

    Effects. Move the iterator to the last element of the previous segment and then move backward count elements.

    Returns. A reference to *this.

    Complexity. Logarithmic amortized in count.

    Note. Non-standard extension.

  18. iterator_t & move_after_segment();

    Effects. Move the iterator to the first element of the next segment.

    Returns. A reference to *this.

    Complexity. Constant amortized.

    Note. Non-standard extension.

  19. iterator_t & move_after_segment(size_type count);

    Effects. Move the iterator to the first element of the next segment and then move forward count elements.

    Complexity. Logarithmic amortized in count.

    Note. Non-standard extension.

  20. iterator_t before_segment() const;

    Returns. A copy of the iterator moved to the last element of the previous segment.

    Complexity. Constant amortized.

    Note. Non-standard extension.

  21. iterator_t after_segment() const;

    Returns. A copy of the iterator moved to the last element of the previous segment and then move backward count elements.

    Complexity. Logarithmic amortized in count.

    Note. Non-standard extension.

  22. iterator_t before_segment(size_type count) const;

    Returns. A copy of the iterator moved to the last element of the previous segment.

    Complexity. Constant amortized.

    Note. Non-standard extension.

  23. iterator_t after_segment(size_type count) const;

    Returns. A copy of the iterator to the first element of the next segment and then move forward count elements.

    Complexity. Logarithmic amortized in count.

    Note. Non-standard extension.

  24. bool operator!=(iterator_t const & other) const;

    Returns. False if both iterators point to the same element. True otherwise.

    Complexity. Constant.

  25. bool operator==(iterator_t const & other) const;

    Returns. True if both iterators point to the same element. False otherwise.

    Complexity. Constant.

  26. bool operator<(iterator_t const & other) const;

    Returns. True if *this points to an element before other. False otherwise.

    Complexity. Constant.

  27. bool operator>(iterator_t const & other) const;

    Returns. True if *this points to an element after other. False otherwise.

    Complexity. Constant.

  28. bool operator<=(iterator_t const & other) const;

    Returns. True if *this points to the same element or before other. False otherwise.

    Complexity. Constant.

  29. bool operator>=(iterator_t const & other) const;

    Returns. True if *this points to the same element or after other. False otherwise.

    Complexity. Constant.


PrevUpHomeNext