-
Notifications
You must be signed in to change notification settings - Fork 11
Changed pragma once to include guard, Added maybe_unused to unused params, Removed comment cruft #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changed pragma once to include guard, Added maybe_unused to unused params, Removed comment cruft #75
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| #pragma once | ||
| #pragma GCC diagnostic ignored "-Wunused-parameter" | ||
| #ifndef BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP | ||
| #define BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP | ||
|
|
||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2023 Gonzalo Brito Gadeschi. All rights | ||
|
|
@@ -320,7 +320,8 @@ template <class T> struct zero_sized { | |
| using size_type = uint8_t; | ||
| static constexpr T *storage_data() noexcept { return nullptr; } | ||
| static constexpr size_type storage_size() noexcept { return 0; } | ||
| static constexpr void unsafe_set_size(size_t new_size) noexcept { | ||
| static constexpr void | ||
| unsafe_set_size([[maybe_unused]] size_t new_size) noexcept { | ||
| IV_EXPECT(new_size == 0 && | ||
| "tried to change size of empty storage to non-zero value"); | ||
| } | ||
|
|
@@ -467,34 +468,6 @@ struct inplace_vector | |
|
|
||
| // [containers.sequences.inplace_vector.cons], construct/copy/destroy | ||
| constexpr inplace_vector() noexcept = default; | ||
| // constexpr explicit inplace_vector(size_type n); | ||
| // constexpr inplace_vector(size_type n, const T& value); | ||
| // template <class InputIterator> // BUGBUG: why not model input_iterator? | ||
| // constexpr inplace_vector(InputIterator first, InputIterator | ||
| // last); | ||
| // template <details::inplace_vector::container_compatible_range<T> R> | ||
| // constexpr inplace_vector(from_range_t, R&& rg); | ||
| // from base-class, trivial if is_trivially_copy_constructible_v<T>: | ||
| // constexpr inplace_vector(const inplace_vector&); | ||
| // from base-class, trivial if is_trivially_move_constructible_v<T> | ||
| // constexpr inplace_vector(inplace_vector&&) noexcept(N == 0 || | ||
| // std::is_nothrow_move_constructible_v<T>); | ||
| // constexpr inplace_vector(std::initializer_list<T> il); | ||
| // from base-class, trivial if is_trivially_destructible_v<T> | ||
| // constexpr ~inplace_vector(); | ||
| // from base-class, trivial if is_trivially_destructible_v<T> && | ||
| // is_trivially_copy_assignable_v<T> | ||
| // constexpr inplace_vector& operator=(const inplace_vector& other); | ||
| // from base-class, trivial if is_trivially_destructible_v<T> && | ||
| // is_trivially_copy_assignable_v<T> | ||
| // constexpr inplace_vector& operator=(inplace_vector&& other) | ||
| // noexcept(N == 0 || is_nothrow_move_assignable_v<T>); | ||
| // template <class InputIterator> // BUGBUG: why not model input_iterator | ||
| // constexpr void assign(InputIterator first, InputIterator last); | ||
| // template<details::inplace_vector::container_compatible_range<T> R> | ||
| // constexpr void assign_range(R&& rg); | ||
| // constexpr void assign(size_type n, const T& u); | ||
| // constexpr void assign(std::initializer_list<T> il); | ||
|
|
||
| // iterators | ||
| constexpr iterator begin() noexcept { return storage_data(); } | ||
|
|
@@ -563,45 +536,6 @@ struct inplace_vector | |
| constexpr T *data() noexcept { return storage_data(); } | ||
| constexpr const T *data() const noexcept { return storage_data(); } | ||
|
|
||
| // [containers.sequences.inplace_vector.modifiers], modifiers | ||
| // template <class... Args> | ||
| // constexpr T& emplace_back(Args&&... args); | ||
| // constexpr T& push_back(const T& x); | ||
| // constexpr T& push_back(T&& x); | ||
| // template<details::inplace_vector::container_compatible_range<T> R> | ||
| // constexpr void append_range(R&& rg); | ||
| // constexpr void pop_back(); | ||
|
|
||
| // template<class... Args> | ||
| // constexpr T* try_emplace_back(Args&&... args); | ||
| // constexpr T* try_push_back(const T& value); | ||
| // constexpr T* try_push_back(T&& value); | ||
|
|
||
| // template<class... Args> | ||
| // constexpr T& unchecked_emplace_back(Args&&... args); | ||
| // constexpr T& unchecked_push_back(const T& value); | ||
| // constexpr T& unchecked_push_back(T&& value); | ||
|
|
||
| // template <class... Args> | ||
| // constexpr iterator emplace(const_iterator position, Args&&... args); | ||
| // constexpr iterator insert(const_iterator position, const T& x); | ||
| // constexpr iterator insert(const_iterator position, T&& x); | ||
| // constexpr iterator insert(const_iterator position, size_type n, const | ||
| // T& x); | ||
| // template <class InputIterator> | ||
| // constexpr iterator insert(const_iterator position, InputIterator | ||
| // first, InputIterator last); | ||
| // template<details::inplace_vector::container_compatible_range<T> R> | ||
| // constexpr iterator insert_range(const_iterator position, R&& rg); | ||
| // constexpr iterator insert(const_iterator position, | ||
| // std::initializer_list<T> | ||
| // il); constexpr iterator erase(const_iterator position); constexpr | ||
| // iterator erase(const_iterator first, const_iterator last); constexpr | ||
| // void swap(inplace_vector& x) | ||
| // noexcept(N == 0 || (std::is_nothrow_swappable_v<T> && | ||
| // std::is_nothrow_move_constructible_v<T>)); | ||
| // constexpr void clear() noexcept; | ||
|
|
||
| constexpr friend bool operator==(const inplace_vector &x, | ||
| const inplace_vector &y) { | ||
| return x.size() == y.size() && std::ranges::equal(x, y); | ||
|
|
@@ -615,12 +549,14 @@ struct inplace_vector | |
| } | ||
|
|
||
| private: // Utilities | ||
| constexpr void assert_iterator_in_range(const_iterator it) noexcept { | ||
| constexpr void | ||
| assert_iterator_in_range([[maybe_unused]] const_iterator it) noexcept { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These functions are left over artifacts from the original reference implementation. iirc they're not used anywhere, |
||
| IV_EXPECT(begin() <= it && "iterator not in range"); | ||
| IV_EXPECT(it <= end() && "iterator not in range"); | ||
| } | ||
| constexpr void assert_valid_iterator_pair(const_iterator first, | ||
| const_iterator last) noexcept { | ||
| constexpr void | ||
| assert_valid_iterator_pair([[maybe_unused]] const_iterator first, | ||
| [[maybe_unused]] const_iterator last) noexcept { | ||
| IV_EXPECT(first <= last && "invalid iterator pair"); | ||
| } | ||
| constexpr void assert_iterator_pair_in_range(const_iterator first, | ||
|
|
@@ -1044,3 +980,5 @@ constexpr std::size_t erase_if(inplace_vector<T, N> &c, Predicate pred) { | |
| } // namespace beman | ||
|
|
||
| #undef IV_EXPECT | ||
|
|
||
| #endif // BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work?
This is assuming we remove all the assertion related artifact.