-
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
Conversation
…rams, Removed comment cruft
|
Issue: #73 |
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.
This looks good to me.
Of course I'm realizing this repo basically doesn't have any testing turned on! ugh! New issue incoming...
I see you have to click approve and run workflows for the CI to run.
edit: Forgot to say welcome @Intedai - thank you for your contribution!
Thanks! 😃 |
|
Please merge when ready. |
DeveloperPaul123
left a comment
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.
Looks good to me! Nice work 👍
| private: // Utilities | ||
| constexpr void assert_iterator_in_range(const_iterator it) noexcept { | ||
| constexpr void | ||
| assert_iterator_in_range([[maybe_unused]] const_iterator it) noexcept { |
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.
These functions are left over artifacts from the original reference implementation. iirc they're not used anywhere, IV_EXPECT is defined as a no-op currently, I think it's safe to remove all these artifacts
| 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"); | ||
| } |
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.
| 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"); | |
| } | |
| static constexpr void | |
| unsafe_set_size(size_t) noexcept {} |
Does this work?
This is assuming we remove all the assertion related artifact.
wusatosi
left a comment
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.
Thanks for the help, we can remove the artifacts from the assertion factilities in another PR.
we should make an issue for this work. I think, without looking at the original, the intent of these are to be static asserts for preconditions which could be enabled. So if we agree that this is the case we should consider seeing if we can get a compiler with contracts and turn them into contract preconditions -- and maybe otherwise they just turn into asserts. See this paper https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3471r4.html for details. Just to extract one thing: As an example: a.front() |
20162026
left a comment
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.
there is some more comment cruft left at:
| // constexpr void resize(size_type sz); |
| // constexpr const_reference at(size_type n) const; |
| // constexpr friend auto /*synth-three-way-result<T>*/ |
As far as I know there hasn't been any compiler releases that support contracts. Let's hold this off till there's some compiler support as we currently do not have infrastructures that builds custom compilers for POCs. Can you open an issue about this? For now I think we should simply remove all the artifact. We can do this in another PR or in the same PR. |
If you look on godbolt at least gcc has several experimental versions with contracts -- I'm not sure which one (if any) corresponds to P2900.
Again, there's nothing stopping someone from making those plain old assert checks -- contracts is just a fancier way to do that and have more control over the runtime results.
Done: #78 |
We have no infrastructure to test on experimental versions of gcc, this is on my road map but it's not there yet. I am still very much against putting things in that are not testable.
We can bring back the assertion facilities if that's what you're suggesting. Thanks for opening the issue. |
|
|
||
| #undef IV_EXPECT | ||
|
|
||
| #endif // BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP |
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.
[pre-commit] reported by reviewdog 🐶
| #endif // BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP | |
| #endif // BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP |
|
Fixed merge conflict, sorry about the second commit accidentally removed the new line at the end 😢 |
No you're fine, thanks for helping out! There's a bit more cruft left, see @20162026 's comment. Otherwise let me know when you think this PR is ready to merge. |
|
@wusatosi I removed the remaining cruft, I'm pretty sure the pr is ready to merge |
River (@wusatosi ):
fixes #79
fixes #73