cpp-sdl2
C++ header-only SDL2 wrapper
|
Namespaces | |
details | |
Classes | |
struct | allocator |
Allocator usable with standard containers. More... | |
struct | deleter |
deleter usable with std::unique_ptr<T> . More... | |
class | deleter< T[]> |
deleter usable with std::unique_ptr<T[]> . More... | |
Typedefs | |
template<typename T > | |
using | unique_ptr = std::unique_ptr< T, simd::deleter< T > > |
Functions | |
size_t | get_alignment () |
Report the alignment this system needs for SIMD allocations. More... | |
void * | alloc (size_t len) |
Allocate memory in a SIMD-friendly way. More... | |
void | free (void *ptr) |
Deallocate memory obtained from sdl::simd::alloc(). More... | |
template<typename T , typename... Args> | |
auto | make_unique (Args &&... args) -> std::enable_if_t<!std::is_array_v< T >, unique_ptr< T >> |
Equivalent of std::make_unique<T> that returns a simd::unique_ptr. More... | |
template<typename T > | |
auto | make_unique (std::size_t count) -> std::enable_if_t< std::is_array_v< T > &&std::extent_v< T >==0 |
Allocate and default construct count elements. More... | |
for (std::size_t i=0;i< count;++i) new(mem+i) U | |
return | unique_ptr< T > (mem, deleter< T >(count)) |
template<typename T , typename... Args> | |
auto | make_shared (Args &&... args) -> std::enable_if<!std::is_array_v< T >, std::shared_ptr< T >> |
Equivalent of std::make_shared<T> that uses simd-friendly storage. More... | |
Variables | |
auto | unique_ptr< T > = delete |
allocator< U > | a |
auto * | mem = a.allocate(count) |
using sdl::simd::unique_ptr = typedef std::unique_ptr<T, simd::deleter<T> > |
|
inline |
Allocate memory in a SIMD-friendly way.
See SDL_SIMDAlloc
for more info.
Definition at line 21 of file simd.hpp.
Referenced by sdl::simd::allocator< T >::allocate().
|
new |
|
inline |
Deallocate memory obtained from sdl::simd::alloc().
Definition at line 27 of file simd.hpp.
Referenced by sdl::simd::allocator< T >::deallocate(), sdl::simd::deleter< T >::operator()(), and sdl::simd::deleter< T[]>::operator()().
|
inline |
auto sdl::simd::make_shared | ( | Args &&... | args | ) | -> std::enable_if<!std::is_array_v<T>, std::shared_ptr<T>> |
Equivalent of std::make_shared<T>
that uses simd-friendly storage.
Definition at line 152 of file simd.hpp.
References a, sdl::simd::allocator< T >::allocate(), and mem.
auto sdl::simd::make_unique | ( | Args &&... | args | ) | -> std::enable_if_t<!std::is_array_v<T>, unique_ptr<T>> |
Equivalent of std::make_unique<T>
that returns a simd::unique_ptr.
make_unique<T[N]>
is deleted.
Definition at line 128 of file simd.hpp.
References a, and sdl::simd::allocator< T >::allocate().
|
pure virtual |
Allocate and default construct count
elements.
return sdl::simd::unique_ptr< T > | ( | mem | , |
deleter< T > | count | ||
) |
allocator<U> sdl::simd::a |
Definition at line 144 of file simd.hpp.
Referenced by sdl::Texture::access(), sdl::Color::as_uint(), sdl::Color::Color(), make_shared(), make_unique(), sdl::Color::operator==(), and sdl::Renderer::set_drawcolor().
auto* sdl::simd::mem = a.allocate(count) |
Definition at line 145 of file simd.hpp.
Referenced by sdl::simd::allocator< T >::allocate(), and make_shared().
auto sdl::simd::unique_ptr< T > = delete |