24#ifndef CONTAINER_ARRAY_ATOMICS_INDEX_PADDING
25#define CONTAINER_ARRAY_ATOMICS_INDEX_PADDING
59 using type = std::atomic<T>;
112 return index * this->m_cacheline_size;
117 return memory::minimum_cacheline_for<Padded_indexing::type>();
Indexing provider that pads each of the array elements to the size of the CPU cache line,...
Definition: atomics_array_index_padding.h:57
size_t translate(size_t index) const
Translates the element index to the byte position in the array.
Definition: atomics_array_index_padding.h:111
Padded_indexing(size_t max_size)
Constructor for the class that takes the maximum allowed number of elements in the array.
Definition: atomics_array_index_padding.h:100
size_t size() const
The size of the array.
Definition: atomics_array_index_padding.h:106
size_t m_size
The size of the array.
Definition: atomics_array_index_padding.h:93
std::atomic< T > type
Definition: atomics_array_index_padding.h:59
static size_t element_size()
The array element size, in bytes.
Definition: atomics_array_index_padding.h:116
virtual ~Padded_indexing()=default
Class destructor.
size_t m_cacheline_size
The size of the CPU cache line.
Definition: atomics_array_index_padding.h:95
Definition: atomics_array.h:39
Definition: aligned_atomic.h:44
static size_t minimum_cacheline_for()
Retrieves the amount of bytes, multiple of the current cacheline size, needed to store an element of ...
Definition: aligned_atomic.h:134