mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Added rvalue reference variants
This commit is contained in:
parent
f8c6830807
commit
a8f07e0622
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user