diff options
Diffstat (limited to 'euler/include/std/vector.hpp')
-rw-r--r-- | euler/include/std/vector.hpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/euler/include/std/vector.hpp b/euler/include/std/vector.hpp index 1c35d9d..8cd02b4 100644 --- a/euler/include/std/vector.hpp +++ b/euler/include/std/vector.hpp @@ -131,6 +131,12 @@ namespace std { } + void clear() { + for (size_type i = 0; i < _size; ++i) + std::destroy_at(_data + i); + _size = 0; + } + constexpr size_type size() const noexcept { return _size; } @@ -188,6 +194,18 @@ namespace std { ++_size; } + using iterator = T *; + using const_iterator = const T *; + + iterator begin() noexcept { return _data; } + iterator end() noexcept { return _data + _size; } + + const_iterator begin() const noexcept { return _data; } + const_iterator end() const noexcept { return _data + _size; } + + const_iterator cbegin() const noexcept { return _data; } + const_iterator cend() const noexcept { return _data + _size; } + }; } |