array/sarray: add move constructor
This commit is contained in:
parent
d57a4dddc2
commit
040db9118c
@ -23,6 +23,13 @@ namespace cruft {
|
|||||||
template <std::size_t S, typename T>
|
template <std::size_t S, typename T>
|
||||||
class sarray {
|
class sarray {
|
||||||
public:
|
public:
|
||||||
|
sarray (sarray &&rhs) noexcept (std::is_nothrow_move_constructible_v<T>)
|
||||||
|
: m_size (rhs.m_size)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_size; ++i)
|
||||||
|
::new (&m_data.objects[i]) (T) (std::move (rhs[i]));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
sarray (sarray const &rhs)
|
sarray (sarray const &rhs)
|
||||||
: sarray (cruft::view (rhs))
|
: sarray (cruft::view (rhs))
|
||||||
|
Loading…
Reference in New Issue
Block a user