cds  2.3.2
cds::opt::v::initialized_static_buffer< T, Capacity, Exp2 > Class Template Reference

Static initialized buffer. More...

#include <cds/opt/buffer.h>

Data Structures

struct  rebind
 Rebind buffer for other template parameters. More...
 

Public Types

typedef T value_type
 value type
 

Public Member Functions

 initialized_static_buffer () noexcept
 Construct static buffer.
 
 initialized_static_buffer (size_t nCapacity) noexcept
 Construct buffer of given capacity. More...
 
 initialized_static_buffer (const initialized_static_buffer &)=delete
 
initialized_static_bufferoperator= (const initialized_static_buffer &)=delete
 
value_typeoperator[] (size_t i)
 Get item i.
 
const value_typeoperator[] (size_t i) const
 Get item i, const version.
 
constexpr size_t capacity () const noexcept
 Returns buffer capacity.
 
void zeroize ()
 Zeroize the buffer.
 
value_typebuffer () noexcept
 Returns pointer to buffer array.
 
value_typebuffer () const noexcept
 Returns pointer to buffer array.
 
size_t mod (size_t idx)
 Returns idx % capacity() More...
 

Static Public Attributes

static constexpr const size_t c_nCapacity = Capacity
 Capacity.
 
static constexpr const bool c_bExp2 = Exp2
 Exp2 flag
 

Detailed Description

template<typename T, size_t Capacity, bool Exp2 = true>
class cds::opt::v::initialized_static_buffer< T, Capacity, Exp2 >

Static initialized buffer.

One of available type for opt::buffer option.

This buffer maintains static array of default-constructed elements. No dynamic memory allocation performed.

Template parameters:
  • T - item type the buffer stores
  • Capacity - the capacity of buffer. The value must be power of two if Exp2 is true
  • Exp2 - a boolean flag. If it is true the buffer capacity must be power of two. Otherwise it can be any positive number. Usually, it is required that the buffer has size of a power of two.

Constructor & Destructor Documentation

◆ initialized_static_buffer()

template<typename T , size_t Capacity, bool Exp2 = true>
cds::opt::v::initialized_static_buffer< T, Capacity, Exp2 >::initialized_static_buffer ( size_t  nCapacity)
inlinenoexcept

Construct buffer of given capacity.

This ctor ignores nCapacity argument. The capacity of static buffer is defined by template argument Capacity

Member Function Documentation

◆ mod()

template<typename T , size_t Capacity, bool Exp2 = true>
size_t cds::opt::v::initialized_static_buffer< T, Capacity, Exp2 >::mod ( size_t  idx)
inline

Returns idx % capacity()

If the buffer size is a power of two, binary arithmethics is used instead of modulo arithmetics


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

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:52 by Doxygen 1.8.13