sandbox
Loading...
Searching...
No Matches
cache.hpp
1
#ifndef LIBSBX_MEMORY_CACHE_HPP_
2
#define LIBSBX_MEMORY_CACHE_HPP_
3
4
#include <new>
5
6
namespace
sbx::memory {
7
8
struct
cacheline
{
9
inline
static
constexpr
auto
size = std::hardware_constructive_interference_size;
10
};
// struct cacheline
11
12
template
<
typename
Type>
13
struct
cacheline_aligned
{
14
alignas
(2u * cacheline::size) Type data;
15
16
template
<
typename
... Args>
17
cacheline_aligned
(Args&&... args)
18
: data{std::forward<Args>(args)...} { }
19
20
operator
Type&() {
21
return
data;
22
}
23
24
operator
const
Type&()
const
{
25
return
data;
26
}
27
28
};
// struct cacheline_aligned
29
30
}
// namespace sbx::memory
31
32
#endif
// LIBSBX_MEMORY_CACHE_HPP_
sbx::memory::cacheline_aligned
Definition:
cache.hpp:13
sbx::memory::cacheline
Definition:
cache.hpp:8
libsbx-memory
libsbx
memory
cache.hpp
Generated by
1.9.5