Open
Conversation
pbackus
suggested changes
Jul 5, 2023
Comment on lines
+245
to
+247
| auto byKey(this This)() inout @safe return scope | ||
| { | ||
| return MapRange!(This, IterType.key)(cast(Unqual!(This)*) &this); | ||
| return MapRange!(This, IterType.key)((() @trusted => cast(Unqual!(This)*) &this)()); |
There was a problem hiding this comment.
You're returning &this, not this, so the correct lifetime annotation here is return ref (i.e., return, since the ref on this is implicit), not return scope.
Comment on lines
+274
to
+276
| auto byValue(this This)() inout @safe return scope | ||
| { | ||
| return MapRange!(This, IterType.value)(cast(Unqual!(This)*) &this); | ||
| return MapRange!(This, IterType.value)((() @trusted => cast(Unqual!(This)*) &this)()); |
Comment on lines
+306
to
+308
| auto byKeyValue(this This)() inout @safe return scope | ||
| { | ||
| return MapRange!(This, IterType.both)(cast(Unqual!(This)*) &this); | ||
| return MapRange!(This, IterType.both)((() @trusted => cast(Unqual!(This)*) &this)()); |
| private: | ||
|
|
||
| this(Unqual!(MapType)* hm) | ||
| this(Unqual!(MapType)* hm) @safe |
There was a problem hiding this comment.
The compiler should be able to infer this.
| } | ||
|
|
||
| void rotateLeft(ref Node* root, AllocatorType allocator) @safe | ||
| void rotateLeft(ref Node* root, AllocatorType allocator) @trusted |
There was a problem hiding this comment.
Why does this need to be @trusted? How do we know that what it's doing is memory safe? Please add a comment for future maintainers.
| } | ||
|
|
||
| void rotateRight(ref Node* root, AllocatorType allocator) @safe | ||
| void rotateRight(ref Node* root, AllocatorType allocator) @trusted |
| newRoot.parent.right = newRoot; | ||
| else | ||
| newRoot.parent.left = newRoot; | ||
| (() @trusted { |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.