Loading...
Searching...
No Matches
alignment.h
Go to the documentation of this file.
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2014 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_ALIGNMENT_INCLUDED
#define ETL_ALIGNMENT_INCLUDED
#include "platform.h"
#include "error_handler.h"
#include "exception.h"
#include "static_assert.h"
#include "type_traits.h"
#include "utility.h"
#include <stdint.h>
namespace etl
{
//***************************************************************************
//***************************************************************************
class alignment_exception : public etl::exception
{
public:
alignment_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
: exception(reason_, file_name_, line_number_)
{
}
};
//***************************************************************************
//***************************************************************************
class alignment_error : public alignment_exception
{
public:
alignment_error(string_type file_name_, numeric_type line_number_)
: alignment_exception(ETL_ERROR_TEXT("alignment:error", ETL_ALIGNMENT_FILE_ID"A"), file_name_, line_number_)
{
}
};
//***************************************************************************
//***************************************************************************
class typed_storage_error : public alignment_exception
{
public:
typed_storage_error(string_type file_name_, numeric_type line_number_)
: alignment_exception(ETL_ERROR_TEXT("typed_storage:error", ETL_ALIGNMENT_FILE_ID"B"), file_name_, line_number_)
{
}
};
//*****************************************************************************
//*****************************************************************************
inline bool is_aligned(const void* p, size_t required_alignment)
{
uintptr_t address = reinterpret_cast<uintptr_t>(p);
return (address % required_alignment) == 0U;
}
//*****************************************************************************
//*****************************************************************************
template <size_t Alignment>
bool is_aligned(const void* p)
{
uintptr_t address = reinterpret_cast<uintptr_t>(p);
return (address % Alignment) == 0U;
}
//*****************************************************************************
//*****************************************************************************
template <typename T>
bool is_aligned(const void* p)
{
return is_aligned<etl::alignment_of<T>::value>(p);
}
namespace private_alignment
{
#if ETL_USING_CPP11
//***************************************************************************
// Matcher.
//***************************************************************************
template <bool Is_Match, size_t Alignment, typename... TRest>
class type_with_alignment_matcher;
// Matching alignment.
template <size_t Alignment, typename T1, typename... TRest>
class type_with_alignment_matcher<true, Alignment, T1, TRest...>
{
public:
typedef T1 type;
};
// Non-matching alignment
template <size_t Alignment, typename T1, typename T2, typename... TRest>
class type_with_alignment_matcher<false, Alignment, T1, T2, TRest...>
{
public:
typedef typename type_with_alignment_matcher< Alignment <= etl::alignment_of<T2>::value, Alignment, T2, TRest... >::type type;
};
// Non-matching alignment, none left.
template <size_t Alignment, typename T1>
class type_with_alignment_matcher<false, Alignment, T1>
{
public:
typedef char type;
};
//***************************************************************************
// Helper.
//***************************************************************************
template <size_t Alignment, typename T1, typename... T>
class type_with_alignment_helper
{
public:
typedef typename type_with_alignment_matcher<Alignment <= etl::alignment_of<T1>::value, Alignment, T1, T...>::type type;
};
#else
//***************************************************************************
// Matcher.
//***************************************************************************
template <bool Is_Match, const size_t Alignment, typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void>
class type_with_alignment_matcher;
// Matching alignment.
template <size_t Alignment, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
class type_with_alignment_matcher<true, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
typedef T1 type;
};
// Non-matching alignment.
template <size_t Alignment, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
class type_with_alignment_matcher<false, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
typedef
typename type_with_alignment_matcher< Alignment <= etl::alignment_of<T2>::value, Alignment, T2, T3, T4, T5, T6, T7, T8, void>::type type;
};
// Non-matching alignment, none left.
template <size_t Alignment>
class type_with_alignment_matcher<false, Alignment, void, void, void, void, void, void, void, void>
{
public:
typedef char type;
};
//***************************************************************************
// Helper.
//***************************************************************************
template <size_t Alignment, typename T1, typename T2 = void, typename T3 = void, typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
class type_with_alignment_helper
{
public:
typedef typename type_with_alignment_matcher< Alignment <= etl::alignment_of<T1>::value, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>::type type;
};
#endif
} // namespace private_alignment
//***************************************************************************
//***************************************************************************
template <size_t Alignment>
class type_with_alignment
{
public:
#if ETL_USING_CPP11
typedef struct
{
alignas(Alignment) char dummy;
} type;
#else
#if ETL_NOT_USING_64BIT_TYPES
typedef typename private_alignment::type_with_alignment_helper< Alignment, int_least8_t, int_least16_t, int32_t, float, double, void*>::type type;
#else
typedef
typename private_alignment::type_with_alignment_helper< Alignment, int_least8_t, int_least16_t, int32_t, int64_t, float, double, void*>::type
type;
#endif
#endif
ETL_STATIC_ASSERT(etl::alignment_of<type>::value == Alignment, "Unable to create the type with the specified alignment");
};
#if ETL_USING_CPP11
template <size_t Alignment>
using type_with_alignment_t = typename type_with_alignment<Alignment>::type;
#endif
//***************************************************************************
//***************************************************************************
template <size_t Length, const size_t Alignment>
struct aligned_storage
{
struct type
{
template <typename T>
operator T&()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
T* t = *this;
return *t;
}
template <typename T>
operator const T&() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
const T* t = *this;
return *t;
}
template <typename T>
operator T*()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<T*>(data);
}
template <typename T>
operator const T*() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<const T*>(data);
}
template <typename T>
T& get_reference()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
T* t = *this;
return *t;
}
template <typename T>
const T& get_reference() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
const T* t = *this;
return *t;
}
template <typename T>
T* get_address()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<T*>(data);
}
template <typename T>
const T* get_address() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<const T*>(data);
}
#if ETL_USING_CPP11 && !defined(ETL_COMPILER_ARM5)
alignas(Alignment) char data[Length];
#else
union
{
char data[Length];
typename etl::type_with_alignment<Alignment>::type etl_alignment_type; // A POD type that has the same alignment
// as Alignment.
};
#endif
};
};
#if ETL_USING_CPP11
template <size_t Length, const size_t Alignment>
using aligned_storage_t = typename aligned_storage<Length, Alignment>::type;
#endif
//***************************************************************************
//***************************************************************************
template <size_t Length, typename T>
struct aligned_storage_as : public etl::aligned_storage<Length, etl::alignment_of<T>::value>
{
};
#if ETL_USING_CPP11
template <size_t Length, typename T>
using aligned_storage_as_t = typename aligned_storage_as<Length, T>::type;
#endif
//***************************************************************************
//***************************************************************************
template <typename T>
class typed_storage
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
//***************************************************************************
// Default constructor
//***************************************************************************
ETL_CONSTEXPR typed_storage() ETL_NOEXCEPT
: valid(false)
{
}
#if ETL_USING_CPP11
//***************************************************************************
//***************************************************************************
template <typename... TArgs>
typed_storage(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: valid(false)
{
create(etl::forward<TArgs>(args)...);
}
#else
//***************************************************************************
//***************************************************************************
template <typename T1>
typed_storage(const T1& t1)
: valid(false)
{
create(t1);
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2>
typed_storage(const T1& t1, const T2& t2)
: valid(false)
{
create(t1, t2);
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3>
typed_storage(const T1& t1, const T2& t2, const T3& t3)
: valid(false)
{
create(t1, t2, t3);
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
typed_storage(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
: valid(false)
{
create(t1, t2, t3, t4);
}
#endif
//***************************************************************************
//***************************************************************************
~typed_storage() ETL_NOEXCEPT
{
// Intentionally empty.
}
//***************************************************************************
//***************************************************************************
bool has_value() const ETL_NOEXCEPT
{
return valid;
}
#if ETL_USING_CPP11
//***************************************************************************
//***************************************************************************
template <typename... TArgs>
reference create(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(etl::forward<TArgs>(args)...);
valid = true;
return *p;
}
#else
//***************************************************************************
//***************************************************************************
template <typename T1>
reference create(const T1& t1)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1);
valid = true;
return *p;
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2>
reference create(const T1& t1, const T2& t2)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1, t2);
valid = true;
return *p;
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3>
reference create(const T1& t1, const T2& t2, const T3& t3)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1, t2, t3);
valid = true;
return *p;
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
reference create(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1, t2, t3, t4);
valid = true;
return *p;
}
#endif
//***************************************************************************
//***************************************************************************
void destroy() ETL_NOEXCEPT
{
if (has_value())
{
storage.value.~T();
valid = false;
}
}
//***************************************************************************
//***************************************************************************
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return &storage.value;
}
//***************************************************************************
//***************************************************************************
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return &storage.value;
}
//***************************************************************************
//***************************************************************************
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
//***************************************************************************
//***************************************************************************
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
private:
typed_storage(etl::typed_storage<T>&) ETL_DELETE;
typed_storage& operator=(etl::typed_storage<T>&) ETL_DELETE;
struct dummy_t
{
};
//*******************************
union union_type
{
ETL_CONSTEXPR union_type() ETL_NOEXCEPT
: dummy()
{
}
~union_type() ETL_NOEXCEPT {}
dummy_t dummy;
value_type value;
} storage;
bool valid;
};
//***************************************************************************
//***************************************************************************
template <typename T>
class typed_storage_ext
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
template <typename U>
friend ETL_CONSTEXPR14 void swap(typed_storage_ext<U>& lhs, typed_storage_ext<U>& rhs) ETL_NOEXCEPT;
//***************************************************************************
//***************************************************************************
typed_storage_ext(void* pbuffer_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
}
#if ETL_USING_CPP11
//***************************************************************************
//***************************************************************************
template <typename... TArgs>
typed_storage_ext(void* pbuffer_, TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(etl::forward<TArgs>(args)...);
}
//***************************************************************************
//***************************************************************************
typed_storage_ext(typed_storage_ext<T>&& other) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(other.pbuffer)
, valid(other.valid)
{
other.pbuffer = ETL_NULLPTR;
other.valid = false;
}
#else
//***************************************************************************
//***************************************************************************
template <typename T1>
typed_storage_ext(void* pbuffer_, const T1& t1)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1);
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2>
typed_storage_ext(void* pbuffer_, const T1& t1, const T2& t2)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1, t2);
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3>
typed_storage_ext(void* pbuffer_, const T1& t1, const T2& t2, const T3& t3)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1, t2, t3);
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
typed_storage_ext(void* pbuffer_, const T1& t1, const T2& t2, const T3& t3, const T4& t4)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1, t2, t3, t4);
}
#endif
//***************************************************************************
//***************************************************************************
~typed_storage_ext() ETL_NOEXCEPT
{
// Intentionally empty.
}
//***************************************************************************
//***************************************************************************
bool has_value() const ETL_NOEXCEPT
{
return valid;
}
#if ETL_USING_CPP11
//***************************************************************************
//***************************************************************************
template <typename... TArgs>
reference create(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(etl::forward<TArgs>(args)...);
valid = true;
return *p;
}
#else
//***************************************************************************
//***************************************************************************
template <typename T1>
reference create(const T1& t1)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1);
valid = true;
return *p;
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2>
reference create(const T1& t1, const T2& t2)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1, t2);
valid = true;
return *p;
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3>
reference create(const T1& t1, const T2& t2, const T3& t3)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1, t2, t3);
valid = true;
return *p;
}
//***************************************************************************
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
reference create(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1, t2, t3, t4);
valid = true;
return *p;
}
#endif
//***************************************************************************
//***************************************************************************
void destroy() ETL_NOEXCEPT
{
if (has_value())
{
pbuffer->~T();
valid = false;
}
}
//***************************************************************************
//***************************************************************************
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return pbuffer;
}
//***************************************************************************
//***************************************************************************
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return pbuffer;
}
//***************************************************************************
//***************************************************************************
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
//***************************************************************************
//***************************************************************************
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
private:
typed_storage_ext(etl::typed_storage_ext<T>&) ETL_DELETE;
typed_storage_ext& operator=(etl::typed_storage_ext<T>&) ETL_DELETE;
pointer pbuffer;
bool valid;
};
//***************************************************************************
//***************************************************************************
template <typename T>
ETL_CONSTEXPR14 void swap(etl::typed_storage_ext<T>& lhs, etl::typed_storage_ext<T>& rhs) ETL_NOEXCEPT
{
using ETL_OR_STD::swap;
swap(lhs.pbuffer, rhs.pbuffer);
swap(lhs.valid, rhs.valid);
}
} // namespace etl
#endif
swap
void swap(etl::array_view< T > &lhs, etl::array_view< T > &rhs) ETL_NOEXCEPT
Swaps the values.
Definition array_view.h:692
etl::alignment_error
Memory misalignment exception.
Definition alignment.h:66
etl::private_alignment::type_with_alignment_helper
Definition alignment.h:204
etl::private_alignment::type_with_alignment_matcher
Definition alignment.h:168
etl::typed_storage_error
Typed storage exception.
Definition alignment.h:79
etl::typed_storage_ext
Definition alignment.h:608
etl::typed_storage_ext::typed_storage_ext
typed_storage_ext(void *pbuffer_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Constructor.
Definition alignment.h:623
etl::typed_storage_ext::typed_storage_ext
typed_storage_ext(void *pbuffer_, const T1 &t1, const T2 &t2)
Constructs the instance of T with types T1, T2.
Definition alignment.h:672
etl::typed_storage_ext::operator*
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:838
etl::typed_storage_ext::create
reference create(const T1 &t1, const T2 &t2)
Definition alignment.h:758
etl::typed_storage_ext::operator->
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:810
etl::typed_storage_ext::create
reference create(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Definition alignment.h:786
etl::typed_storage_ext::create
reference create(const T1 &t1, const T2 &t2, const T3 &t3)
Definition alignment.h:772
etl::typed_storage_ext::typed_storage_ext
typed_storage_ext(void *pbuffer_, const T1 &t1)
Constructs the instance of T with type T1.
Definition alignment.h:660
etl::typed_storage_ext::destroy
void destroy() ETL_NOEXCEPT
Calls the destructor of the stored object, if created.
Definition alignment.h:798
etl::typed_storage_ext::~typed_storage_ext
~typed_storage_ext() ETL_NOEXCEPT
Definition alignment.h:709
etl::typed_storage_ext::has_value
bool has_value() const ETL_NOEXCEPT
Definition alignment.h:718
etl::typed_storage_ext::typed_storage_ext
typed_storage_ext(void *pbuffer_, const T1 &t1, const T2 &t2, const T3 &t3)
Constructs the instance of T with types T1, T2, T3.
Definition alignment.h:684
etl::typed_storage_ext::operator*
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:830
etl::typed_storage_ext::typed_storage_ext
typed_storage_ext(void *pbuffer_, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Constructs the instance of T with types T1, T2, T3, T4.
Definition alignment.h:696
etl::typed_storage_ext::create
reference create(const T1 &t1)
Definition alignment.h:744
etl::typed_storage_ext::operator->
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:820
etl::typed_storage
Definition alignment.h:364
etl::typed_storage::create
reference create(const T1 &t1, const T2 &t2)
Definition alignment.h:487
etl::typed_storage::create
reference create(const T1 &t1)
Definition alignment.h:473
etl::typed_storage::operator*
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:559
etl::typed_storage::destroy
void destroy() ETL_NOEXCEPT
Calls the destructor of the stored object, if created.
Definition alignment.h:527
etl::typed_storage::has_value
bool has_value() const ETL_NOEXCEPT
Definition alignment.h:447
etl::typed_storage::typed_storage
typed_storage(const T1 &t1)
Constructs the instance of T with type T1.
Definition alignment.h:397
etl::typed_storage::operator*
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:567
etl::typed_storage::~typed_storage
~typed_storage() ETL_NOEXCEPT
Definition alignment.h:438
etl::typed_storage::operator->
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:549
etl::typed_storage::create
reference create(const T1 &t1, const T2 &t2, const T3 &t3)
Definition alignment.h:501
etl::typed_storage::operator->
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
Definition alignment.h:539
etl::typed_storage::typed_storage
typed_storage(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Constructs the instance of T with types T1, T2, T3, T4.
Definition alignment.h:427
etl::typed_storage::typed_storage
typed_storage(const T1 &t1, const T2 &t2, const T3 &t3)
Constructs the instance of T with types T1, T2, T3.
Definition alignment.h:417
etl::typed_storage::create
reference create(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Definition alignment.h:515
etl::typed_storage::typed_storage
typed_storage(const T1 &t1, const T2 &t2)
Constructs the instance of T with types T1, T2.
Definition alignment.h:407
error_handler.h
exception.h
etl::type_with_alignment
Definition alignment.h:218
etl::aligned_storage
Definition alignment.h:251
etl::aligned_storage_as
Definition alignment.h:346
ETL_ASSERT
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
etl::exception::exception
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
etl::exception
Definition exception.h:59
type
etl
Definition absolute.h:40
etl::swap
ETL_CONSTEXPR14 void swap(etl::typed_storage_ext< T > &lhs, etl::typed_storage_ext< T > &rhs) ETL_NOEXCEPT
Swap two etl::typed_storage_ext.
Definition alignment.h:856
etl::data
ETL_CONSTEXPR TContainer::pointer data(TContainer &container)
Definition iterator.h:1470
etl::is_aligned
bool is_aligned(const void *p, size_t required_alignment)
Check that 'p' has 'required_alignment'.
Definition alignment.h:91
platform.h
etl::aligned_storage::type
Definition alignment.h:253
etl::aligned_storage::type::get_address
const T * get_address() const
Get address as const T pointer.
Definition alignment.h:316
etl::aligned_storage::type::get_address
T * get_address()
Get address as T pointer.
Definition alignment.h:308
etl::aligned_storage::type::get_reference
const T & get_reference() const
Get address as const T reference.
Definition alignment.h:299
etl::aligned_storage::type::get_reference
T & get_reference()
Get address as T reference.
Definition alignment.h:290
etl::reference
type_traits.h
utility.h