3 #ifndef INCLUDE_NN_NLIB_DYNAMICALIGNEDSTORAGE_H_ 4 #define INCLUDE_NN_NLIB_DYNAMICALIGNEDSTORAGE_H_ 15 if (align == 0)
return EINVAL;
16 if ((align & (align - 1)) != 0)
return EINVAL;
17 #ifdef NN_PLATFORM_CTR 19 #elif defined(_MSC_VER) 20 void* p = _aligned_malloc(size, align);
24 if (!p)
return ENOMEM;
26 #ifdef NN_PLATFORM_CTR 32 void* tmp = rhs.storage_;
33 rhs.storage_ = storage_;
38 _aligned_free(storage_);
44 #ifndef NN_PLATFORM_CTR 47 uintptr_t pos = (
reinterpret_cast<uintptr_t
>(storage_) + (align_ - 1)) & ~(align_ - 1);
48 return reinterpret_cast<void*
>(pos);
54 #ifdef NN_PLATFORM_CTR 67 #endif // INCLUDE_NN_NLIB_DYNAMICALIGNEDSTORAGE_H_
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
~DynamicAlignedStorage() noexcept
Destructor.
A class for obtaining aligned memory.
void swap(DynamicAlignedStorage &rhs) noexcept
Swaps objects.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
void * Get() noexcept
Returns a pointer to the allocated region.
A file that contains the configuration information for each development environment.
DynamicAlignedStorage() noexcept
Instantiates the object with default parameters (default constructor).