Home Libraries People FAQ More

Main Page | Class Hierarchy | Class List | File List | Class Members

boost::circular_buffer_space_optimized< T, Alloc > Class Template Reference

Space optimized circular buffer container adaptor. More...

#include <adaptor.hpp>

Inherits boost::circular_buffer< T, Alloc >< T, Alloc >.

List of all members.

Public Types

typedef circular_buffer< T,
Alloc >::value_type 
value_type
 The type of the elements stored in the circular buffer.

typedef circular_buffer< T,
Alloc >::pointer 
pointer
 Pointer to the element.

typedef circular_buffer< T,
Alloc >::const_pointer 
const_pointer
 Const pointer to the element.

typedef circular_buffer< T,
Alloc >::reference 
reference
 Reference to the element.

typedef circular_buffer< T,
Alloc >::const_reference 
const_reference
 Const reference to the element.

typedef circular_buffer< T,
Alloc >::size_type 
size_type
 Size type.

typedef circular_buffer< T,
Alloc >::difference_type 
difference_type
 Distance type.

typedef circular_buffer< T,
Alloc >::allocator_type 
allocator_type
 The type of the allocator used in the circular buffer.

typedef circular_buffer< T,
Alloc >::const_iterator 
const_iterator
 Const (random access) iterator used to iterate through a circular buffer.

typedef circular_buffer< T,
Alloc >::iterator 
iterator
 Iterator (random access) used to iterate through a circular buffer.

typedef circular_buffer< T,
Alloc >::const_reverse_iterator 
const_reverse_iterator
 Const iterator used to iterate backwards through a circular buffer.

typedef circular_buffer< T,
Alloc >::reverse_iterator 
reverse_iterator
 Iterator used to iterate backwards through a circular buffer.


Public Member Functions

reference operator[] (size_type n)
 Return the element at the index position.

return_value_type operator[] (size_type n) const
 Return the element at the index position.

bool full () const
 See the circular_buffer source documentation.

size_type min_capacity () const
 Return the minimal guaranteed amount of allocated memory.

void set_min_capacity (size_type new_min_capacity)
 Change the minimal guaranteed amount of allocated memory.

size_type capacity () const
 See the circular_buffer source documentation.

size_type internal_capacity () const
 Return the current capacity of the adapted circular buffer.

void set_capacity (size_type new_capacity, bool remove_front=true)
 See the circular_buffer source documentation.

void resize (size_type new_size, param_value_type item=T(), bool remove_front=true)
 See the circular_buffer source documentation.

 circular_buffer_space_optimized (size_type capacity, size_type min_capacity=0, const allocator_type &alloc=allocator_type())
 Create an empty space optimized circular buffer with a given capacity.

 circular_buffer_space_optimized (size_type capacity, size_type min_capacity, param_value_type item, const allocator_type &alloc=allocator_type())
 Create a full space optimized circular buffer filled with copies of item.

template<class InputIterator>  circular_buffer_space_optimized (size_type capacity, size_type min_capacity, InputIterator first, InputIterator last, const allocator_type &alloc=allocator_type())
 Create a space optimized circular buffer with a copy of a range.

void assign (size_type n, param_value_type item)
 See the circular_buffer source documentation.

template<class InputIterator> void assign (InputIterator first, InputIterator last)
 See the circular_buffer source documentation.

void swap (circular_buffer_space_optimized &cb)
 See the circular_buffer source documentation.

void push_back (param_value_type item)
 See the circular_buffer source documentation.

void push_back ()
 See the circular_buffer source documentation.

void push_front (param_value_type item)
 See the circular_buffer source documentation.

void push_front ()
 See the circular_buffer source documentation.

void pop_back ()
 See the circular_buffer source documentation.

void pop_front ()
 See the circular_buffer source documentation.

iterator insert (iterator pos, param_value_type item)
 See the circular_buffer source documentation.

iterator insert (iterator pos)
 See the circular_buffer source documentation.

void insert (iterator pos, size_type n, param_value_type item)
 See the circular_buffer source documentation.

template<class InputIterator> void insert (iterator pos, InputIterator first, InputIterator last)
 See the circular_buffer source documentation.

iterator rinsert (iterator pos, param_value_type item)
 See the circular_buffer source documentation.

iterator rinsert (iterator pos)
 See the circular_buffer source documentation.

void rinsert (iterator pos, size_type n, param_value_type item)
 See the circular_buffer source documentation.

template<class InputIterator> void rinsert (iterator pos, InputIterator first, InputIterator last)
 See the circular_buffer source documentation.

iterator erase (iterator pos)
 See the circular_buffer source documentation.

iterator erase (iterator first, iterator last)
 See the circular_buffer source documentation.

void clear ()
 See the circular_buffer source documentation.


Detailed Description

template<class T, class Alloc>
class boost::circular_buffer_space_optimized< T, Alloc >

Space optimized circular buffer container adaptor.

Parameters:
T The type of the elements stored in the space optimized circular buffer.
Alloc The allocator type used for all internal memory management.
Author:
Jan Gaspar
Version:
1.3
Date:
2004
For more information how to use the space optimized circular buffer see the documentation.


Member Typedef Documentation

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::allocator_type boost::circular_buffer_space_optimized< T, Alloc >::allocator_type
 

The type of the allocator used in the circular buffer.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::const_iterator boost::circular_buffer_space_optimized< T, Alloc >::const_iterator
 

Const (random access) iterator used to iterate through a circular buffer.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::const_pointer boost::circular_buffer_space_optimized< T, Alloc >::const_pointer
 

Const pointer to the element.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::const_reference boost::circular_buffer_space_optimized< T, Alloc >::const_reference
 

Const reference to the element.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::const_reverse_iterator boost::circular_buffer_space_optimized< T, Alloc >::const_reverse_iterator
 

Const iterator used to iterate backwards through a circular buffer.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::difference_type boost::circular_buffer_space_optimized< T, Alloc >::difference_type
 

Distance type.

A signed integral type used to represent the distance between two iterators.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::iterator boost::circular_buffer_space_optimized< T, Alloc >::iterator
 

Iterator (random access) used to iterate through a circular buffer.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::pointer boost::circular_buffer_space_optimized< T, Alloc >::pointer
 

Pointer to the element.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::reference boost::circular_buffer_space_optimized< T, Alloc >::reference
 

Reference to the element.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::reverse_iterator boost::circular_buffer_space_optimized< T, Alloc >::reverse_iterator
 

Iterator used to iterate backwards through a circular buffer.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::size_type boost::circular_buffer_space_optimized< T, Alloc >::size_type
 

Size type.

An unsigned integral type that can represent any nonnegative value of the container's distance type.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
typedef circular_buffer<T, Alloc>::value_type boost::circular_buffer_space_optimized< T, Alloc >::value_type
 

The type of the elements stored in the circular buffer.

Reimplemented from boost::circular_buffer< T, Alloc >.


Constructor & Destructor Documentation

template<class T, class Alloc>
boost::circular_buffer_space_optimized< T, Alloc >::circular_buffer_space_optimized size_type  capacity,
size_type  min_capacity = 0,
const allocator_type alloc = allocator_type()
[inline, explicit]
 

Create an empty space optimized circular buffer with a given capacity.

Parameters:
capacity The capacity of the buffer.
min_capacity The minimal guaranteed amount of allocated memory. (The metrics of the min_capacity is number of items.)
alloc The allocator.
Precondition:
capacity >= min_capacity
Postcondition:
(*this).capacity() == capacity && (*this).size == 0
Allocates memory specified by the min_capacity parameter.
Exceptions:
An allocation error if memory is exhausted (std::bad_alloc if standard allocator is used).
Note:
It is considered as a bug if the precondition is not met (i.e. if capacity < min_capacity) and an assertion will be invoked in the debug mode.

template<class T, class Alloc>
boost::circular_buffer_space_optimized< T, Alloc >::circular_buffer_space_optimized size_type  capacity,
size_type  min_capacity,
param_value_type  item,
const allocator_type alloc = allocator_type()
[inline]
 

Create a full space optimized circular buffer filled with copies of item.

Parameters:
capacity The capacity of the buffer.
min_capacity The minimal guaranteed amount of allocated memory. (The metrics of the min_capacity is number of items.)
item The item to be filled with.
alloc The allocator.
Precondition:
capacity >= min_capacity
Postcondition:
(*this).size() == capacity && (*this)[0] == (*this)[1] == ... == (*this).back() == item
Exceptions:
An allocation error if memory is exhausted (std::bad_alloc if standard allocator is used).
Whatever T::T(const T&) throws.
Note:
It is considered as a bug if the precondition is not met (i.e. if capacity < min_capacity) and an assertion will be invoked in the debug mode.

template<class T, class Alloc>
template<class InputIterator>
boost::circular_buffer_space_optimized< T, Alloc >::circular_buffer_space_optimized size_type  capacity,
size_type  min_capacity,
InputIterator  first,
InputIterator  last,
const allocator_type alloc = allocator_type()
[inline]
 

Create a space optimized circular buffer with a copy of a range.

Parameters:
capacity The capacity of the buffer.
min_capacity The minimal guaranteed amount of allocated memory. (The metrics of the min_capacity is number of items.)
first The beginning of the range.
last The end of the range.
alloc The allocator.
Precondition:
capacity >= min_capacity and valid range [first, last).
Postcondition:
(*this).capacity() == capacity
Allocates at least as much memory as specified by the min_capacity parameter.
If the number of items to copy from the range [first, last) is greater than the specified capacity then only elements from the range [last - capacity, last) will be copied.
Exceptions:
An allocation error if memory is exhausted (std::bad_alloc if standard allocator is used).
Whatever T::T(const T&) throws.
Note:
It is considered as a bug if the precondition is not met (i.e. if capacity < min_capacity) and an assertion will be invoked in the debug mode.


Member Function Documentation

template<class T, class Alloc>
template<class InputIterator>
void boost::circular_buffer_space_optimized< T, Alloc >::assign InputIterator  first,
InputIterator  last
[inline]
 

See the circular_buffer source documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::assign size_type  n,
param_value_type  item
[inline]
 

See the circular_buffer source documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
size_type boost::circular_buffer_space_optimized< T, Alloc >::capacity  )  const [inline]
 

See the circular_buffer source documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::clear  )  [inline]
 

See the circular_buffer source documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
iterator boost::circular_buffer_space_optimized< T, Alloc >::erase iterator  first,
iterator  last
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
iterator boost::circular_buffer_space_optimized< T, Alloc >::erase iterator  pos  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
bool boost::circular_buffer_space_optimized< T, Alloc >::full  )  const [inline]
 

See the circular_buffer source documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
template<class InputIterator>
void boost::circular_buffer_space_optimized< T, Alloc >::insert iterator  pos,
InputIterator  first,
InputIterator  last
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::insert iterator  pos,
size_type  n,
param_value_type  item
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
iterator boost::circular_buffer_space_optimized< T, Alloc >::insert iterator  pos  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
iterator boost::circular_buffer_space_optimized< T, Alloc >::insert iterator  pos,
param_value_type  item
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
size_type boost::circular_buffer_space_optimized< T, Alloc >::internal_capacity  )  const [inline]
 

Return the current capacity of the adapted circular buffer.

Note:
This method is not intended to be used directly by the user. It is defined only for testing purposes.

template<class T, class Alloc>
size_type boost::circular_buffer_space_optimized< T, Alloc >::min_capacity  )  const [inline]
 

Return the minimal guaranteed amount of allocated memory.

The allocated memory will never drop under this value.

template<class T, class Alloc>
return_value_type boost::circular_buffer_space_optimized< T, Alloc >::operator[] size_type  n  )  const [inline]
 

Return the element at the index position.

Precondition:
*(this).size() > index

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
reference boost::circular_buffer_space_optimized< T, Alloc >::operator[] size_type  n  )  [inline]
 

Return the element at the index position.

Precondition:
*(this).size() > index

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::pop_back  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::pop_front  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::push_back  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::push_back param_value_type  item  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::push_front  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::push_front param_value_type  item  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::resize size_type  new_size,
param_value_type  item = T(),
bool  remove_front = true
[inline]
 

See the circular_buffer source documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
template<class InputIterator>
void boost::circular_buffer_space_optimized< T, Alloc >::rinsert iterator  pos,
InputIterator  first,
InputIterator  last
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::rinsert iterator  pos,
size_type  n,
param_value_type  item
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
iterator boost::circular_buffer_space_optimized< T, Alloc >::rinsert iterator  pos  )  [inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
iterator boost::circular_buffer_space_optimized< T, Alloc >::rinsert iterator  pos,
param_value_type  item
[inline]
 

See the circular_buffer source documentation.

Warning:
The rules for iterator invalidation differ from the original circular_buffer. See the documentation.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::set_capacity size_type  new_capacity,
bool  remove_front = true
[inline]
 

See the circular_buffer source documentation.

Precondition:
(*this).min_capacity() <= new_capacity
Note:
It is considered as a bug if the precondition is not met (i.e. if new_capacity > (*this).min_capacity()) and an assertion will be invoked in the debug mode.

Reimplemented from boost::circular_buffer< T, Alloc >.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::set_min_capacity size_type  new_min_capacity  )  [inline]
 

Change the minimal guaranteed amount of allocated memory.

Precondition:
(*this).capacity() >= new_min_capacity
Postcondition:
(*this).min_capacity() == new_min_capacity Allocates memory specified by the new_min_capacity parameter.
Note:
It is considered as a bug if the precondition is not met (i.e. if new_min_capacity > (*this).capacity()) and an assertion will be invoked in the debug mode.

template<class T, class Alloc>
void boost::circular_buffer_space_optimized< T, Alloc >::swap circular_buffer_space_optimized< T, Alloc > &  cb  )  [inline]
 

See the circular_buffer source documentation.