a/r/aligned: add forgotten headers and namespace qualifiers
This commit is contained in:
parent
09a624bf88
commit
f06eab9a3a
@ -17,6 +17,11 @@
|
|||||||
#ifndef CRUFT_UTIL_ALLOC_RAW_ALIGNED_HPP
|
#ifndef CRUFT_UTIL_ALLOC_RAW_ALIGNED_HPP
|
||||||
#define CRUFT_UTIL_ALLOC_RAW_ALIGNED_HPP
|
#define CRUFT_UTIL_ALLOC_RAW_ALIGNED_HPP
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "../../debug.hpp"
|
||||||
|
|
||||||
namespace util::alloc::raw {
|
namespace util::alloc::raw {
|
||||||
/// wraps a child allocator and enforces a fixed alignment
|
/// wraps a child allocator and enforces a fixed alignment
|
||||||
template <typename ChildT>
|
template <typename ChildT>
|
||||||
@ -24,7 +29,7 @@ namespace util::alloc::raw {
|
|||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
template <typename ...Args>
|
template <typename ...Args>
|
||||||
aligned (size_t _alignment, Args &&...args):
|
aligned (std::size_t _alignment, Args &&...args):
|
||||||
m_successor (std::forward<Args> (args)...),
|
m_successor (std::forward<Args> (args)...),
|
||||||
m_alignment (_alignment)
|
m_alignment (_alignment)
|
||||||
{ ; }
|
{ ; }
|
||||||
@ -32,14 +37,14 @@ namespace util::alloc::raw {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
auto
|
auto
|
||||||
allocate (size_t bytes)
|
allocate (std::size_t bytes)
|
||||||
{
|
{
|
||||||
return m_successor.allocate (bytes, m_alignment);
|
return m_successor.allocate (bytes, m_alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
auto
|
auto
|
||||||
allocate (size_t bytes, size_t alignment)
|
allocate (std::size_t bytes, std::size_t alignment)
|
||||||
{
|
{
|
||||||
(void)alignment;
|
(void)alignment;
|
||||||
CHECK_EQ (alignment, m_alignment);
|
CHECK_EQ (alignment, m_alignment);
|
||||||
@ -49,7 +54,7 @@ namespace util::alloc::raw {
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
auto
|
auto
|
||||||
deallocate (void *ptr, size_t bytes)
|
deallocate (void *ptr, std::size_t bytes)
|
||||||
{
|
{
|
||||||
return m_successor.deallocate (ptr, bytes);
|
return m_successor.deallocate (ptr, bytes);
|
||||||
}
|
}
|
||||||
@ -57,7 +62,7 @@ namespace util::alloc::raw {
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
auto
|
auto
|
||||||
deallocate (void *ptr, size_t bytes, size_t alignment)
|
deallocate (void *ptr, std::size_t bytes, std::size_t alignment)
|
||||||
{
|
{
|
||||||
(void)alignment;
|
(void)alignment;
|
||||||
CHECK_EQ (alignment, m_alignment);
|
CHECK_EQ (alignment, m_alignment);
|
||||||
@ -90,7 +95,7 @@ namespace util::alloc::raw {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ChildT m_successor;
|
ChildT m_successor;
|
||||||
size_t m_alignment;
|
std::size_t m_alignment;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user