From 5aa447f19c5a2f33a5b06c6951164fd28eeb7ed1 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:35:04 -0500 Subject: [PATCH 1/4] fix extra ; --- .../beman/inplace_vector/inplace_vector.hpp | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/include/beman/inplace_vector/inplace_vector.hpp b/include/beman/inplace_vector/inplace_vector.hpp index 70fbf8b..9e183c1 100644 --- a/include/beman/inplace_vector/inplace_vector.hpp +++ b/include/beman/inplace_vector/inplace_vector.hpp @@ -293,7 +293,7 @@ class inplace_vector : public inplace_vector_base { if (il.size() != 0) { base::uninitialized_copy(il.begin(), il.end(), this->begin()); } - }; // freestanding-deleted + } // freestanding-deleted constexpr inplace_vector &operator=(std::initializer_list il) { if (Capacity < il.size()) { throw std::bad_alloc(); @@ -315,7 +315,7 @@ class inplace_vector : public inplace_vector_base { } this->change_size(diff); return *this; - }; // freestanding-deleted + } // freestanding-deleted template constexpr void assign(InputIterator first, InputIterator last) { @@ -335,7 +335,7 @@ class inplace_vector : public inplace_vector_base { for (; first != last; ++first) { emplace_back(*first); } - }; // freestanding-deleted + } // freestanding-deleted #if defined(__cpp_lib_containers_ranges) and defined(__cpp_concepts) template @@ -359,7 +359,7 @@ class inplace_vector : public inplace_vector_base { for (; first != last; ++first) { emplace_back(*first); } - }; // freestanding-deleted + } // freestanding-deleted #endif constexpr void assign(size_type n, const T &u) { @@ -379,7 +379,7 @@ class inplace_vector : public inplace_vector_base { base::uninitialized_fill(end, end + diff, u); } this->change_size(diff); - }; // freestanding-deleted + } // freestanding-deleted constexpr void assign(std::initializer_list il) { if (Capacity < il.size()) { throw std::bad_alloc(); @@ -399,7 +399,7 @@ class inplace_vector : public inplace_vector_base { this->end()); } this->change_size(diff); - }; // freestanding-deleted + } // freestanding-deleted // [containers.sequences.inplace.vector.access], element access constexpr reference at(size_type count) { @@ -434,7 +434,7 @@ class inplace_vector : public inplace_vector_base { constexpr reverse_iterator rbegin() noexcept { return reverse_iterator{this->end()}; - }; + } constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{this->end()}; } @@ -452,13 +452,13 @@ class inplace_vector : public inplace_vector_base { constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator{this->begin()}; - }; + } // [containers.sequences.inplace.vector.members] size/capacity - constexpr bool empty() const noexcept { return size() == 0; }; - constexpr size_type size() const noexcept { return this->size_; }; - static constexpr size_type max_size() noexcept { return Capacity; }; - static constexpr size_type capacity() noexcept { return Capacity; }; + constexpr bool empty() const noexcept { return size() == 0; } + constexpr size_type size() const noexcept { return this->size_; } + static constexpr size_type max_size() noexcept { return Capacity; } + static constexpr size_type capacity() noexcept { return Capacity; } constexpr void resize(size_type sz) { const auto diff = static_cast(sz - this->size()); if (diff < 0) { @@ -471,7 +471,7 @@ class inplace_vector : public inplace_vector_base { base::uninitialized_value_construct(end, end + diff); } this->change_size(diff); - }; // freestanding-deleted + } // freestanding-deleted constexpr void resize(size_type sz, const T &c) { const auto diff = static_cast(sz - this->size()); if (diff < 0) { @@ -484,12 +484,12 @@ class inplace_vector : public inplace_vector_base { std::uninitialized_fill(end, end + diff, c); } this->change_size(diff); - }; // freestanding-deleted + } // freestanding-deleted static constexpr void reserve(size_type sz) { if (Capacity < sz) { throw std::bad_alloc(); } - }; // freestanding-deleted + } // freestanding-deleted static constexpr void shrink_to_fit() noexcept {} // [containers.sequences.inplace.vector.modifiers], modifiers @@ -498,20 +498,20 @@ class inplace_vector : public inplace_vector_base { throw std::bad_alloc(); } return this->unchecked_emplace_back(std::forward(args)...); - }; // freestanding-deleted + } // freestanding-deleted constexpr reference push_back(const T &x) { if (this->size() == Capacity) { throw std::bad_alloc(); } return this->unchecked_emplace_back(x); - }; // freestanding-deleted + } // freestanding-deleted constexpr reference push_back(T &&x) { if (this->size() == Capacity) { throw std::bad_alloc(); } return this->unchecked_emplace_back(std::move(x)); - }; // freestanding-deleted + } // freestanding-deleted #if defined(__cpp_lib_containers_ranges) and defined(__cpp_concepts) template @@ -522,7 +522,7 @@ class inplace_vector : public inplace_vector_base { for (; first != last; ++first) { emplace_back(*first); } - }; // freestanding-deleted + } // freestanding-deleted #endif constexpr void pop_back() { @@ -531,7 +531,7 @@ class inplace_vector : public inplace_vector_base { std::destroy(end, end + 1); this->change_size(-1); } - }; + } template constexpr pointer try_emplace_back(Args &&...args) { if (this->size() == Capacity) { @@ -539,14 +539,14 @@ class inplace_vector : public inplace_vector_base { } return std::addressof( this->unchecked_emplace_back(std::forward(args)...)); - }; + } constexpr pointer try_push_back(const T &x) noexcept(std::is_nothrow_copy_constructible_v) { if (this->size() == Capacity) { return nullptr; } return std::addressof(this->unchecked_emplace_back(x)); - }; + } constexpr pointer try_push_back(T &&x) noexcept(std::is_nothrow_move_constructible_v) { @@ -554,7 +554,7 @@ class inplace_vector : public inplace_vector_base { return nullptr; } return std::addressof(this->unchecked_emplace_back(std::move(x))); - }; + } /* template @@ -580,15 +580,15 @@ class inplace_vector : public inplace_vector_base { #endif this->change_size(1); return *final; - }; + } constexpr reference unchecked_push_back(const T &x) noexcept(std::is_nothrow_constructible_v) { return this->unchecked_emplace_back(x); - }; + } constexpr reference unchecked_push_back(T &&x) { return this->unchecked_emplace_back(std::move(x)); - }; + } template constexpr iterator emplace(const_iterator position, Args &&...args) { @@ -609,13 +609,13 @@ class inplace_vector : public inplace_vector_base { *pos = std::move(temp); } return pos; - }; // freestanding-deleted + } // freestanding-deleted constexpr iterator insert(const_iterator position, const T &x) { return emplace(position, x); - }; // freestanding-deleted + } // freestanding-deleted constexpr iterator insert(const_iterator position, T &&x) { return emplace(position, std::move(x)); - }; // freestanding-deleted + } // freestanding-deleted constexpr iterator insert(const_iterator position, size_type n, const T &x) { const iterator pos = position; const iterator end = this->end(); @@ -781,7 +781,7 @@ class inplace_vector : public inplace_vector_base { constexpr friend std::compare_three_way_result operator<=>(const inplace_vector &x, const inplace_vector &y) { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); - }; + } #endif constexpr friend void swap(inplace_vector &x, inplace_vector &y) noexcept( From abae5243716666aa2cbd73679d318ca58bbcd5e4 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:39:02 -0500 Subject: [PATCH 2/4] fix unused var --- tests/beman/inplace_vector/inplace_vector.test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/beman/inplace_vector/inplace_vector.test.cpp b/tests/beman/inplace_vector/inplace_vector.test.cpp index dd09737..65ceeec 100644 --- a/tests/beman/inplace_vector/inplace_vector.test.cpp +++ b/tests/beman/inplace_vector/inplace_vector.test.cpp @@ -68,14 +68,16 @@ void test_exceptions() { { try { vec too_small{}; - auto res = too_small.at(5); + too_small.at(5); + assert(false); } catch (const std::out_of_range &) { } catch (...) { assert(false); } try { const vec too_small{}; - auto res = too_small.at(5); + too_small.at(5); + assert(false); } catch (const std::out_of_range &) { } catch (...) { assert(false); From 3b318cbc2c6f3b5dd66ebdb6f4f50fbbd3992d49 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:40:35 -0500 Subject: [PATCH 3/4] fix unused var --- tests/beman/inplace_vector/inplace_vector.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/beman/inplace_vector/inplace_vector.test.cpp b/tests/beman/inplace_vector/inplace_vector.test.cpp index 65ceeec..68e5cce 100644 --- a/tests/beman/inplace_vector/inplace_vector.test.cpp +++ b/tests/beman/inplace_vector/inplace_vector.test.cpp @@ -27,7 +27,7 @@ template constexpr void test() { ""); assert(const_bracket == T(42)); - auto &&front = range.front(); + [[maybe_unused]] auto &&front = range.front(); static_assert(std::is_same::value, ""); From 3857cd16c240b9be3256ae827e92462a9eddcf76 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:42:01 -0500 Subject: [PATCH 4/4] fix unused var --- tests/beman/inplace_vector/inplace_vector.test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/beman/inplace_vector/inplace_vector.test.cpp b/tests/beman/inplace_vector/inplace_vector.test.cpp index 68e5cce..29ae58f 100644 --- a/tests/beman/inplace_vector/inplace_vector.test.cpp +++ b/tests/beman/inplace_vector/inplace_vector.test.cpp @@ -27,11 +27,11 @@ template constexpr void test() { ""); assert(const_bracket == T(42)); - [[maybe_unused]] auto &&front = range.front(); + auto &&front = range.front(); static_assert(std::is_same::value, ""); - assert(front = T(1)); + assert(front == T(1)); auto &&const_front = const_range.front(); static_assert(