cds
2.3.2
|
Static uninitialized 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 | |
uninitialized_static_buffer () noexcept | |
Construct static buffer. | |
uninitialized_static_buffer (size_t nCapacity) noexcept | |
Construct buffer of given capacity. More... | |
uninitialized_static_buffer (const uninitialized_static_buffer &)=delete | |
uninitialized_static_buffer & | operator= (const uninitialized_static_buffer &)=delete |
value_type & | operator[] (size_t i) |
Get item i . | |
const value_type & | operator[] (size_t i) const |
Get item i , const version. | |
constexpr size_t | capacity () const noexcept |
Returns buffer capacity. | |
void | zeroize () |
Zeroize the buffer. | |
value_type * | buffer () noexcept |
Returns pointer to buffer array. | |
value_type * | buffer () 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 | |
Static uninitialized buffer.
One of available type for opt::buffer
option.
This buffer maintains static array of uninitialized elements. You should manually construct each element when needed. No dynamic memory allocation performed.
T
- item type the buffer storesCapacity
- 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.
|
inlinenoexcept |
Construct buffer of given capacity.
This ctor ignores nCapacity
argument. The capacity of static buffer is defined by template argument Capacity
|
inline |
Returns idx % capacity()
If the buffer size is a power of two, binary arithmethics is used instead of modulo arithmetics