changed all std::destroy

This commit is contained in:
cyborg1811m 2024-01-15 11:51:23 +01:00
parent bb335bd9c3
commit df1f8a82ed
1 changed files with 2 additions and 6 deletions

View File

@ -108,7 +108,7 @@ namespace cc {
[[nodiscard]] constexpr size_type capacity() const noexcept { return _len; }
[[nodiscard]] constexpr size_type size() const noexcept { return _size; }
constexpr void clear() { _erase_no_move(std::begin(_arr), std::end(_arr)); }
constexpr void clear() { std::fill(begin(), end(), T()); }
constexpr iterator insert(const_iterator pos, const T& value);
constexpr iterator insert(const_iterator pos, T&& value);
@ -134,9 +134,6 @@ namespace cc {
template<std::size_t N2>
constexpr void swap(const_vector<T, N2>& other);
protected:
constexpr inline void _erase_no_move(const_iterator first, const_iterator last) { std::destroy(first, last); }
#ifdef UNIT_TEST
friend test_const_vector;
#endif
@ -324,8 +321,7 @@ namespace cc {
auto distance = std::distance(first, last);
if (distance > N) throw std::invalid_argument("Iterator distance in assign surpasses size" + std::to_string(distance) + ">=" + std::to_string(N));
_size = distance;
std::destroy(_arr, _arr + _size);
std::copy(first, last, _arr);
std::copy(first, last, begin());
}
template<typename T, std::size_t N>