baudvine::RingBuf
STL-like ring buffer in C++11
baudvine::detail::ringbuf::Iterator< Ptr, AllocTraits, Capacity > Class Template Reference

An iterator into RingBuf. More...

#include <baudvine/ringbuf.h>

Public Types

using difference_type = typename AllocTraits::difference_type
 
using size_type = typename AllocTraits::difference_type
 
using value_type = typename AllocTraits::value_type
 
using pointer = Ptr
 
using reference = decltype(*pointer{})
 
using iterator_category = std::random_access_iterator_tag
 

Public Member Functions

 Iterator (pointer data, const size_type ring_offset, const size_type ring_index)
 Construct a new iterator object. More...
 
 operator Iterator< typename AllocTraits::const_pointer, AllocTraits, Capacity > () const
 Convert an iterator into a const iterator. More...
 
reference operator* () const
 
pointer operator-> () const noexcept
 
Iterator operator++ (int) noexcept
 
Iteratoroperator++ () noexcept
 
Iterator operator-- (int) noexcept
 
Iteratoroperator-- () noexcept
 
Iteratoroperator+= (difference_type n) noexcept
 
Iterator operator+ (difference_type n) const noexcept
 
Iteratoroperator-= (difference_type n) noexcept
 
Iterator operator- (difference_type n) const noexcept
 
reference operator[] (difference_type n) const
 

Friends

difference_type operator- (const Iterator &lhs, const Iterator &rhs) noexcept
 
Iterator operator+ (difference_type lhs, const Iterator &rhs) noexcept
 
bool operator< (const Iterator &lhs, const Iterator &rhs) noexcept
 
bool operator> (const Iterator &lhs, const Iterator &rhs) noexcept
 
bool operator<= (const Iterator &lhs, const Iterator &rhs) noexcept
 
bool operator>= (const Iterator &lhs, const Iterator &rhs) noexcept
 
bool operator== (const Iterator &lhs, const Iterator &rhs) noexcept
 
bool operator!= (const Iterator &lhs, const Iterator &rhs) noexcept
 
template<typename P , typename A , std::size_t C, typename OutputIt >
OutputIt copy (const Iterator< P, A, C > &begin, const Iterator< P, A, C > &end, OutputIt out)
 

Detailed Description

template<typename Ptr, typename AllocTraits, std::size_t Capacity>
class baudvine::detail::ringbuf::Iterator< Ptr, AllocTraits, Capacity >

An iterator into RingBuf.

Template Parameters
PtrThe pointer type, which determines constness.
AllocTraitsThe allocator traits for the container, used for size/difference_type and const_pointer (for auto conversion to const iterator).
CapacityThe size of the backing array, and maximum size of the ring buffer.

Definition at line 154 of file ringbuf.h.

Constructor & Destructor Documentation

◆ Iterator()

template<typename Ptr , typename AllocTraits , std::size_t Capacity>
baudvine::detail::ringbuf::Iterator< Ptr, AllocTraits, Capacity >::Iterator ( pointer  data,
const size_type  ring_offset,
const size_type  ring_index 
)
inline

Construct a new iterator object.

Parameters
dataPointer to the start of the RingBuf's backing array.
ring_offsetPhysical index of the start of the ring buffer.
ring_indexLogical index in the ring buffer: when the iterator is at ring_offset, ring_index is 0.

Definition at line 172 of file ringbuf.h.

Member Function Documentation

◆ operator Iterator< typename AllocTraits::const_pointer, AllocTraits, Capacity >()

template<typename Ptr , typename AllocTraits , std::size_t Capacity>
baudvine::detail::ringbuf::Iterator< Ptr, AllocTraits, Capacity >::operator Iterator< typename AllocTraits::const_pointer, AllocTraits, Capacity > ( ) const
inline

Convert an iterator into a const iterator.

Returns
A const iterator pointing to the same place.

Definition at line 184 of file ringbuf.h.


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