Added rvalue reference variants

This commit is contained in:
John Wellbelove 2018-12-29 15:34:53 +00:00
parent f8c6830807
commit a8f07e0622

View File

@ -417,6 +417,16 @@ namespace etl
::new (p) T(value);
}
//*****************************************************************************
/// Copy construct an item at address p.
///\ingroup memory
//*****************************************************************************
template <typename T>
void create_copy_at(T* p, T&& value)
{
::new (p) T(std::move(value));
}
//*****************************************************************************
/// Copy construct an item at address p.
///\ingroup memory
@ -462,6 +472,17 @@ namespace etl
return *reinterpret_cast<T*>(p);
}
//*****************************************************************************
/// Construct an item at address p.
///\ingroup memory
//*****************************************************************************
template <typename T>
T& make_copy_at(T* p, T&& other)
{
::new (p) T(std::move(other));
return *reinterpret_cast<T*>(p);
}
//*****************************************************************************
/// Construct an item at address p.
///\ingroup memory
@ -485,6 +506,17 @@ namespace etl
return *reinterpret_cast<T*>(p);
}
//*****************************************************************************
/// 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);
}
//*****************************************************************************
/// Construct an item at address p.
///\ingroup memory