15 #ifndef CORE_CONTAINER_SHARED_DATA_H_
16 #define CORE_CONTAINER_SHARED_DATA_H_
33 #ifdef __cpp_lib_hardware_interference_size
51 struct alignas(hardware_destructive_interference_size)
AlignedT {
58 using Data = std::vector<AlignedT>;
63 for (
auto& info :
data_) {
75 data_.resize(new_size);
86 return index == other.
index && data == other.
data;
90 const T&
operator*()
const {
return (*data)[index].data; }
The SharedData class avoids false sharing between threads.
void resize(size_t new_size)
Resize the SharedData.data_ vector.
std::vector< AlignedT > Data
SharedData(size_t size, const T &value=T())
const T & operator[](size_t index) const
T & operator[](size_t index)
size_t size() const
Get the size of the SharedData.data_ vector.
const Iterator end() const
const Iterator begin() const
#define BDM_CLASS_DEF_NV(class_name, class_version_id)
constexpr std::size_t hardware_constructive_interference_size
constexpr std::size_t hardware_destructive_interference_size
Wrapper for a chacheline-size aligned T.
const T & operator*() const
bool operator!=(const Iterator &other)
bool operator==(const Iterator &other)