1#ifndef CASACORE_MORPHING_ARRAY_H_
2#define CASACORE_MORPHING_ARRAY_H_
32 other.data_ =
nullptr;
39 other.data_ =
nullptr;
50 static_assert(std::is_trivially_destructible_v<T>);
51 if (new_size >
size_) {
60 static_assert(std::is_trivially_destructible_v<T>);
61 return reinterpret_cast<T*
>(
data_);
66 static_assert(std::is_trivially_destructible_v<T>);
67 return reinterpret_cast<T*
>(
data_);
75 if constexpr(
alignof(T) >
sizeof(
void*)) {
76 posix_memalign(&
data_,
alignof(T),
size_ *
sizeof(T));
81 throw std::bad_alloc();
82 std::uninitialized_default_construct_n(
reinterpret_cast<T*
>(
data_),
size_);
void Resize(size_t new_size)
Make sure that the array can hold as least the specified number of elements of type T.
MorphingArray() noexcept=default
MorphingArray(const MorphingArray &)=delete
~MorphingArray() noexcept
MorphingArray & operator=(const MorphingArray &)=delete
MorphingArray(MorphingArray &&other) noexcept
MorphingArray & operator=(MorphingArray &&other) noexcept