dispenso 1.6.2
A library for task parallelism
Loading...
Searching...
No Matches
dispenso::CacheAligned< T > Class Template Reference

#include <platform.h>

Public Member Functions

 CacheAligned (T t)
 

Detailed Description

template<typename T>
class dispenso::CacheAligned< T >

A wrapper that aligns the contained value to cache line boundaries.

Useful for avoiding false sharing in concurrent data structures.

Note
Before C++17, std::allocator does not honour over-alignment, so elements of e.g. a std::vector<CacheAligned<T>> are not guaranteed to be cache-line aligned (and accessing them is undefined behaviour) unless the container uses an allocator that respects alignof(CacheAligned<T>).
Template Parameters
TThe type to wrap with cache line alignment.

Definition at line 225 of file platform.h.

Constructor & Destructor Documentation

◆ CacheAligned()

template<typename T >
dispenso::CacheAligned< T >::CacheAligned ( T t)
inline

Construct from a value.

Parameters
tThe value to wrap.

Definition at line 229 of file platform.h.


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