fixed clear()

This commit is contained in:
Patrick 2024-07-29 16:31:03 +02:00
parent 9fb3eb0419
commit a5f5e45fbd
1 changed files with 8 additions and 1 deletions

View File

@ -114,7 +114,7 @@ namespace cc {
[[nodiscard]] constexpr size_type capacity() const noexcept { return _len; }
[[nodiscard]] constexpr size_type size() const noexcept { return _size; }
constexpr void clear() { std::fill(begin(), end(), T()); }
constexpr void clear();
constexpr iterator insert(const_iterator pos, const T& value);
constexpr iterator insert(const_iterator pos, T&& value);
@ -386,6 +386,13 @@ namespace cc {
return _arr[pos];
}
template<typename T, std::size_t N>
constexpr void const_vector<T, N>::clear()
{
std::destroy(begin(), end());
_size = 0;
}
template<typename T, std::size_t N>
constexpr const_vector<T, N>::iterator const_vector<T, N>::insert(const_vector::const_iterator pos, const T &value)
{