cpp-sdl2
C++ header-only SDL2 wrapper
simd.hpp File Reference

Go to the source code of this file.

Classes

struct  sdl::simd::allocator< T >
 Allocator usable with standard containers. More...
 
struct  sdl::simd::allocator< T >::rebind< U >
 
struct  sdl::simd::deleter< T >
 deleter usable with std::unique_ptr<T>. More...
 
class  sdl::simd::deleter< T[]>
 deleter usable with std::unique_ptr<T[]>. More...
 

Namespaces

 sdl::simd
 
 sdl::simd::details
 

Typedefs

template<typename T >
using sdl::simd::unique_ptr = std::unique_ptr< T, simd::deleter< T > >
 

Functions

size_t sdl::simd::get_alignment ()
 Report the alignment this system needs for SIMD allocations. More...
 
void * sdl::simd::alloc (size_t len)
 Allocate memory in a SIMD-friendly way. More...
 
void sdl::simd::free (void *ptr)
 Deallocate memory obtained from sdl::simd::alloc(). More...
 
template<typename T >
void sdl::simd::details::destroy_at (T *ptr)
 recursive implementation of std::destroy_at, only available from C++20 onwards. More...
 
template<typename T , typename... Args>
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. More...
 
template<typename T >
auto sdl::simd::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...
 
 sdl::simd::for (std::size_t i=0;i< count;++i) new(mem+i) U
 
return sdl::simd::unique_ptr< T > (mem, deleter< T >(count))
 
template<typename T , typename... Args>
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. More...
 

Variables

auto sdl::simd::unique_ptr< T > = delete
 
allocator< U > sdl::simd::a
 
auto * sdl::simd::mem = a.allocate(count)