openMSX
Public Types | Public Member Functions | List of all members
cb_iterator< BUF, T > Class Template Reference

This code is heavily based on boost circular_buffer: http://www.boost.org/doc/libs/1_55_0/doc/html/circular_buffer.html The interface of this version and the original boost version is (as much as possible identical). More...

#include <circular_buffer.hh>

Public Types

using value_type = T
 
using pointer = T *
 
using reference = T &
 
using difference_type = ptrdiff_t
 
using iterator_category = std::random_access_iterator_tag
 

Public Member Functions

 cb_iterator ()
 
 cb_iterator (const cb_iterator &it)
 
 cb_iterator (const BUF *buf_, T *p_)
 
cb_iteratoroperator= (const cb_iterator &it)
 
T & operator* () const
 
T * operator-> () const
 
difference_type operator- (const cb_iterator &it) const
 
cb_iteratoroperator++ ()
 
cb_iteratoroperator-- ()
 
cb_iterator operator++ (int)
 
cb_iterator operator-- (int)
 
cb_iteratoroperator+= (difference_type n)
 
cb_iteratoroperator-= (difference_type n)
 
cb_iterator operator+ (difference_type n)
 
cb_iterator operator- (difference_type n)
 
T & operator[] (difference_type n) const
 
bool operator== (const cb_iterator &it) const
 
bool operator!= (const cb_iterator &it) const
 
bool operator< (const cb_iterator &it) const
 
bool operator> (const cb_iterator &it) const
 
bool operator<= (const cb_iterator &it) const
 
bool operator>= (const cb_iterator &it) const
 

Detailed Description

template<typename BUF, typename T>
class cb_iterator< BUF, T >

This code is heavily based on boost circular_buffer: http://www.boost.org/doc/libs/1_55_0/doc/html/circular_buffer.html The interface of this version and the original boost version is (as much as possible identical).

I did leave out some of the more fancy methods like insert/remove in the middle of the buffer or linearize the buffer. If we ever need those we can add them of course. So (for now) this class represents a dynamically sized circular buffer with (efficient) {push,pop}_{front,back} and operator[] methods. It also offers random access iterators. For much more details check the boost documentation.Random access iterator for circular_buffer.

Definition at line 23 of file circular_buffer.hh.

Member Typedef Documentation

◆ difference_type

template<typename BUF, typename T>
using cb_iterator< BUF, T >::difference_type = ptrdiff_t

Definition at line 29 of file circular_buffer.hh.

◆ iterator_category

template<typename BUF, typename T>
using cb_iterator< BUF, T >::iterator_category = std::random_access_iterator_tag

Definition at line 30 of file circular_buffer.hh.

◆ pointer

template<typename BUF, typename T>
using cb_iterator< BUF, T >::pointer = T*

Definition at line 27 of file circular_buffer.hh.

◆ reference

template<typename BUF, typename T>
using cb_iterator< BUF, T >::reference = T&

Definition at line 28 of file circular_buffer.hh.

◆ value_type

template<typename BUF, typename T>
using cb_iterator< BUF, T >::value_type = T

Definition at line 26 of file circular_buffer.hh.

Constructor & Destructor Documentation

◆ cb_iterator() [1/3]

template<typename BUF, typename T>
cb_iterator< BUF, T >::cb_iterator ( )
inline

◆ cb_iterator() [2/3]

template<typename BUF, typename T>
cb_iterator< BUF, T >::cb_iterator ( const cb_iterator< BUF, T > &  it)
inline

Definition at line 33 of file circular_buffer.hh.

◆ cb_iterator() [3/3]

template<typename BUF, typename T>
cb_iterator< BUF, T >::cb_iterator ( const BUF *  buf_,
T *  p_ 
)
inline

Definition at line 34 of file circular_buffer.hh.

Member Function Documentation

◆ operator!=()

template<typename BUF, typename T>
bool cb_iterator< BUF, T >::operator!= ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 80 of file circular_buffer.hh.

◆ operator*()

template<typename BUF, typename T>
T& cb_iterator< BUF, T >::operator* ( ) const
inline

Definition at line 40 of file circular_buffer.hh.

◆ operator+()

template<typename BUF, typename T>
cb_iterator cb_iterator< BUF, T >::operator+ ( difference_type  n)
inline

Definition at line 74 of file circular_buffer.hh.

References cb_iterator< BUF, T >::cb_iterator().

◆ operator++() [1/2]

template<typename BUF, typename T>
cb_iterator& cb_iterator< BUF, T >::operator++ ( )
inline

Definition at line 47 of file circular_buffer.hh.

◆ operator++() [2/2]

template<typename BUF, typename T>
cb_iterator cb_iterator< BUF, T >::operator++ ( int  )
inline

Definition at line 57 of file circular_buffer.hh.

◆ operator+=()

template<typename BUF, typename T>
cb_iterator& cb_iterator< BUF, T >::operator+= ( difference_type  n)
inline

Definition at line 60 of file circular_buffer.hh.

◆ operator-() [1/2]

template<typename BUF, typename T>
difference_type cb_iterator< BUF, T >::operator- ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 43 of file circular_buffer.hh.

◆ operator-() [2/2]

template<typename BUF, typename T>
cb_iterator cb_iterator< BUF, T >::operator- ( difference_type  n)
inline

Definition at line 75 of file circular_buffer.hh.

References cb_iterator< BUF, T >::cb_iterator().

◆ operator--() [1/2]

template<typename BUF, typename T>
cb_iterator& cb_iterator< BUF, T >::operator-- ( )
inline

Definition at line 52 of file circular_buffer.hh.

◆ operator--() [2/2]

template<typename BUF, typename T>
cb_iterator cb_iterator< BUF, T >::operator-- ( int  )
inline

Definition at line 58 of file circular_buffer.hh.

◆ operator-=()

template<typename BUF, typename T>
cb_iterator& cb_iterator< BUF, T >::operator-= ( difference_type  n)
inline

Definition at line 72 of file circular_buffer.hh.

◆ operator->()

template<typename BUF, typename T>
T* cb_iterator< BUF, T >::operator-> ( ) const
inline

Definition at line 41 of file circular_buffer.hh.

◆ operator<()

template<typename BUF, typename T>
bool cb_iterator< BUF, T >::operator< ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 82 of file circular_buffer.hh.

◆ operator<=()

template<typename BUF, typename T>
bool cb_iterator< BUF, T >::operator<= ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 86 of file circular_buffer.hh.

◆ operator=()

template<typename BUF, typename T>
cb_iterator& cb_iterator< BUF, T >::operator= ( const cb_iterator< BUF, T > &  it)
inline

Definition at line 36 of file circular_buffer.hh.

◆ operator==()

template<typename BUF, typename T>
bool cb_iterator< BUF, T >::operator== ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 79 of file circular_buffer.hh.

◆ operator>()

template<typename BUF, typename T>
bool cb_iterator< BUF, T >::operator> ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 85 of file circular_buffer.hh.

◆ operator>=()

template<typename BUF, typename T>
bool cb_iterator< BUF, T >::operator>= ( const cb_iterator< BUF, T > &  it) const
inline

Definition at line 87 of file circular_buffer.hh.

◆ operator[]()

template<typename BUF, typename T>
T& cb_iterator< BUF, T >::operator[] ( difference_type  n) const
inline

Definition at line 77 of file circular_buffer.hh.


The documentation for this class was generated from the following file: