Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
aligned.h File Reference
#include <momentum/common/exception.h>
#include <limits>
#include <memory>

Go to the source code of this file.

Classes

struct  momentum::AlignedDeleter
 Custom deleter for aligned memory. More...
class  momentum::AlignedAllocator< T, Alignment >
 An allocator that aligns memory blocks according to a specified alignment. More...
struct  momentum::AlignedAllocator< T, Alignment >::rebind< U >

Namespaces

namespace  momentum

Macros

#define MOMENTUM_HAS_ALIGNED_ALLOC   0
#define MOMENTUM_HAS_POSIX_MEMALIGN   0

Functions

void * momentum::aligned_malloc (size_t size, size_t)
void momentum::aligned_free (void *ptr)
constexpr std::size_t momentum::roundUpToAlignment (std::size_t value, std::size_t alignment)
 Rounds value up to the nearest multiple of alignment (in bytes).
template<typename T, std::size_t Alignment = alignof(T)>
T * momentum::alignedAlloc (std::size_t n)
 Allocates a block of memory that can hold n elements of type T with the specified alignment.
template<typename T, std::size_t Alignment = alignof(T), class Deleter = AlignedDeleter>
std::unique_ptr< T, Deleter > momentum::makeAlignedUnique (std::size_t n, Deleter deleter=Deleter())
 Creates a std::unique_ptr for aligned memory.
template<typename T, std::size_t Alignment = alignof(T), class Deleter = AlignedDeleter>
std::shared_ptr< T > momentum::makeAlignedShared (std::size_t n, Deleter deleter=Deleter())
 Creates a std::shared_ptr for aligned memory.
template<class T, class U, std::size_t Alignment>
bool momentum::operator== (const AlignedAllocator< T, Alignment > &, const AlignedAllocator< U, Alignment > &)
 Checks if storage allocated from lhs can be deallocated from rhs, and vice versa.
template<class T, class U, std::size_t Alignment>
bool momentum::operator!= (const AlignedAllocator< T, Alignment > &, const AlignedAllocator< U, Alignment > &)
 Checks if storage allocated from lhs cannot be deallocated from rhs, and vice versa.

Macro Definition Documentation

◆ MOMENTUM_HAS_ALIGNED_ALLOC

#define MOMENTUM_HAS_ALIGNED_ALLOC   0

Definition at line 42 of file aligned.h.

◆ MOMENTUM_HAS_POSIX_MEMALIGN

#define MOMENTUM_HAS_POSIX_MEMALIGN   0

Definition at line 50 of file aligned.h.