1 #ifndef SIPLASPLAS_TYPEERASURE_ANYSTORAGE_FIXEDSIZE_HPP 2 #define SIPLASPLAS_TYPEERASURE_ANYSTORAGE_FIXEDSIZE_HPP 4 #include <siplasplas/utility/memory_manip.hpp> 5 #include <siplasplas/typeerasure/typeinfo.hpp> 19 template<std::
size_t Size, std::
size_t Alignment = alignof(std::u
int8_t)>
28 return reinterpret_cast<const char*
>(&_storage);
36 return reinterpret_cast<char*
>(&_storage);
42 const char*
end()
const 58 constexpr std::size_t
size()
const 99 return reinterpret_cast<const char*
>(
storage(cpp::typeerasure::TypeInfo::get<T>())) +
sizeof(T) <=
end();
103 std::aligned_storage_t<Size, Alignment> _storage;
108 #endif // SIPLASPLAS_TYPEERASURE_ANYSTORAGE_FIXEDSIZE_HPP Definition: canary_allocator.hpp:7
Implements fixed-size storage.
Definition: fixedsize.hpp:20
const char * begin() const
Returns a pointer to the beginning of the storage.
Definition: fixedsize.hpp:26
SIPLASPLAS_UTILITY_EXPORT char * aligned_ptr(char *pointer, std::size_t alignment)
Returns an address aligned to an specific boundary.
constexpr std::size_t size() const
Returns the size in bytes of the storage.
Definition: fixedsize.hpp:58
const void * storage(cpp::typeerasure::TypeInfo typeInfo) const
Returns a pointer to the storage memory space.
Definition: fixedsize.hpp:72
std::size_t alignment() const
returns the alignment of the type
Definition: typeinfo.hpp:275
char * end()
Returns a pointer to the end of the storage.
Definition: fixedsize.hpp:50
void * storage(cpp::typeerasure::TypeInfo typeInfo)
Returns a pointer to the storage memory space.
Definition: fixedsize.hpp:86
char * begin()
Returns a pointer to the beginning of the storage.
Definition: fixedsize.hpp:34
const char * end() const
Returns a pointer to the end of the storage.
Definition: fixedsize.hpp:42
Contains minimal information to execute the value semantics operations of a type. ...
Definition: typeinfo.hpp:112
bool objectFitsInStorage() const
Checks if an object can be hosted in the storage space.
Definition: fixedsize.hpp:97