-
Notifications
You must be signed in to change notification settings - Fork 11
implement missing functions #84
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
|
There were already some tests for AssignInitializerList but the compiler probably substituted the il assignment with something else (il constructor?), so they passed successfully even without the implementation |
| T, std::ranges::range_reference_t<std::initializer_list<T>>> && | ||
| std::movable<T>) | ||
| { | ||
| clear(); |
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.
surely this is a pessimisation if the current is smaller than than the il -- of course we can't get the size of the initializer list because sometimes we're really dumb...
however we could perform the insert first and then only clear the elements needed -- hmm -- yeah idk this might be better. ugh
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.
I dont think it matters much as for trivial type clear is just a setsize and for nontrivial it is setsize+destructor call (no memory allocation or other potential overhead).
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.
well currently there's no optimization for trivial types -- which is a whole thing. it actually destroys all the elements.
edit: no it just erases, which doesn't destruct
edit2: So why isn't this simply assign_range( il );
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.
yeah I will fix that, it definatly should have been assign_range...
also constexpr iterator insert(const_iterator position, InputIterator first, InputIterator last) implementation might not be correct, but I will investigate it tomorrow.
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.
edit: no it just erases, which doesn't destruct
What do you mean here
JeffGarland
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.
I'm approving even though I have one outstanding comment. This is better than it was and I'm sure there will be more passes on this code for further possible optimizations.
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.
thank you for your contribution
implement:
try_append_rangeis not implemented #64Fixes #64
Fixes #81