Ejemplo n.º 1
0
 //! Increment operator (prefix).
 iterator& operator ++ () {
     BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(m_it != 0);        // check for iterator pointing to end()
     m_buff->increment(m_it);
     if (m_it == m_buff->m_last)
         m_it = 0;
     return *this;
 }
Ejemplo n.º 2
0
 //! Decrement operator (prefix).
 iterator& operator -- () {
     BOOST_CB_ASSERT(is_valid(m_buff));        // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(m_it != m_buff->m_first); // check for iterator pointing to begin()
     if (m_it == 0)
         m_it = m_buff->m_last;
     m_buff->decrement(m_it);
     return *this;
 }
Ejemplo n.º 3
0
 //! Iterator subtraction.
 iterator& operator -= (difference_type n) {
     BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
     if (n > 0) {
         BOOST_CB_ASSERT(*this - m_buff->begin() >= n); // check for too large n
         m_it = m_buff->sub(m_it == 0 ? m_buff->m_last : m_it, n);
     } else if (n < 0) {
         *this += -n;
     }
     return *this;
 }
Ejemplo n.º 4
0
 //! Difference operator.
 difference_type operator - (const iterator& it) const {
     BOOST_CB_ASSERT(is_valid(m_buff));    // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
     helper_pointer<Traits> lhs = create_helper_pointer(*this);
     helper_pointer<Traits> rhs = create_helper_pointer(it);
     if (less(rhs, lhs) && lhs.m_it <= rhs.m_it)
         return (lhs.m_it - rhs.m_it) + static_cast<difference_type>(m_buff->capacity());
     if (less(lhs, rhs) && lhs.m_it >= rhs.m_it)
         return (lhs.m_it - rhs.m_it) - static_cast<difference_type>(m_buff->capacity());
     return lhs.m_it - rhs.m_it;
 }
Ejemplo n.º 5
0
 //! Iterator addition.
 iterator& operator += (difference_type n) {
     BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
     if (n > 0) {
         BOOST_CB_ASSERT(m_buff->end() - *this >= n); // check for too large n
         m_it = m_buff->add(m_it, n);
         if (m_it == m_buff->m_last)
             m_it = 0;
     } else if (n < 0) {
         *this -= -n;
     }
     return *this;
 }
Ejemplo n.º 6
0
 bool operator < (const iterator<Buff, Traits0>& it) const {
     BOOST_CB_ASSERT(is_valid(m_buff));    // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
     return linearize_pointer(*this) < linearize_pointer(it);
 }
Ejemplo n.º 7
0
 bool operator != (const iterator<Buff, Traits0>& it) const {
     BOOST_CB_ASSERT(is_valid(m_buff));    // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
     return m_it != it.m_it;
 }
Ejemplo n.º 8
0
 //! Dereferencing operator.
 reference operator * () const {
     BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(m_it != 0);        // check for iterator pointing to end()
     return *m_it;
 }
Ejemplo n.º 9
0
 //! Constructor.
 capacity_control(Size buffer_capacity, Size min_buffer_capacity = 0)
 : m_capacity(buffer_capacity), m_min_capacity(min_buffer_capacity)
 { // Check for capacity lower than min_capacity.
     BOOST_CB_ASSERT(buffer_capacity >= min_buffer_capacity);
 }
Ejemplo n.º 10
0
 bool operator < (const iterator<Buff, Traits0>& it) const {
     BOOST_CB_ASSERT(is_valid(m_buff));    // check for uninitialized or invalidated iterator
     BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
     return less(create_helper_pointer(*this), create_helper_pointer(it));
 }
Ejemplo n.º 11
0
 //! Constructor.
 capacity_control(Size capacity, Size min_capacity = 0)
 : m_capacity(capacity), m_min_capacity(min_capacity) {
     BOOST_CB_ASSERT(capacity >= min_capacity); // check for capacity lower than min_capacity
 }