Multiple vec fixes that are useful to implement canvas_ity. #11
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.
I found quite a bit of oddities in vector still.
Remove bizzarre idata() method, normally inout should not contaminate identifiers. Fixed that in strings, I supposed the goal was to not return mutable C string from numem string
vec.ptr() as alias to vec.data(), which is now inout. It fixed
ref auto opOpAssign(string op = "~")(vector!T other)
that usesother.ptr
vec.length
as alias ofvec.size
compiler suggested that
vec.opDollar
beconst
orinout
clear()
andremove()
will clean-up items in reverse manner just like the destructor, and only if not a basic type.ref inout(T) opIndex
. else you can't index vector fields in const methods.BREAKING
vec.remove()
is fixed (it was not possible to remove zero items with its API without crashing) and is now "delete [start, end)" instead of "delete [start, end]". Changed error recovery that swaps start and end to assertion. That makes the functions more similar in contract to c++std::vector::erase()
and a bit more expected to me. IF the contract doesn't change, at least it should say plainly that this will crash if no items are removed.