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 Implements fixed-size storage.
Definition: fixedsize.hpp:20
Definition: messaging.hpp:8
bool objectFitsInStorage() const
Checks if an object can be hosted in the storage space.
Definition: fixedsize.hpp:97
char * begin()
Returns a pointer to the beginning of the storage.
Definition: fixedsize.hpp:34
void * storage(cpp::typeerasure::TypeInfo typeInfo)
Returns a pointer to the storage memory space.
Definition: fixedsize.hpp:86
constexpr std::size_t size() const
Returns the size in bytes of the storage.
Definition: fixedsize.hpp:58
Contains minimal information to execute the value semantics operations of a type. ...
Definition: typeinfo.hpp:115
const void * storage(cpp::typeerasure::TypeInfo typeInfo) const
Returns a pointer to the storage memory space.
Definition: fixedsize.hpp:72
SIPLASPLAS_UTILITY_EXPORT char * aligned_ptr(char *pointer, std::size_t alignment)
Returns an address aligned to an specific boundary.
Definition: memory_manip.cpp:23
const char * end() const
Returns a pointer to the end of the storage.
Definition: fixedsize.hpp:42
const char * begin() const
Returns a pointer to the beginning of the storage.
Definition: fixedsize.hpp:26
char * end()
Returns a pointer to the end of the storage.
Definition: fixedsize.hpp:50