Update memory.h to handle C++11 (#110)

* Merge remote-tracking branch 'origin/development'

* Update memory.h to handle C++11
This commit is contained in:
Bo Rydberg 2019-01-06 18:25:13 +01:00 committed by John Wellbelove
parent 6c141f3621
commit 4b7d832590
2 changed files with 14 additions and 0 deletions

View File

@ -418,6 +418,7 @@ namespace etl
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef T&& rvalue_reference;
#if ETL_CPP11_SUPPORTED
typedef T&& rvalue_reference;
#endif

View File

@ -510,6 +510,19 @@ namespace etl
return *reinterpret_cast<T*>(p);
}
#if ETL_CPP11_SUPPORTED
//*****************************************************************************
/// Construct an item at address p.
///\ingroup memory
//*****************************************************************************
template <typename T, typename TParameter>
T& make_value_at(T* p, TParameter&& value)
{
::new (p) T(std::move(value));
return *reinterpret_cast<T*>(p);
}
#endif
//*****************************************************************************
/// Construct an item at address p.
///\ingroup memory