Add min() and max() method to get the extent of a tree.#21
Open
BenFrantzDale wants to merge 8 commits intoekg:masterfrom
Open
Add min() and max() method to get the extent of a tree.#21BenFrantzDale wants to merge 8 commits intoekg:masterfrom
BenFrantzDale wants to merge 8 commits intoekg:masterfrom
Conversation
Reorder template arguments so it's more like std::map
Add min/max functions to get the extent of the tree.
BenFrantzDale
commented
Apr 13, 2018
| return std::min_element(intervals.begin(), intervals.end(), | ||
| IntervalStartCmp())->start; | ||
| } | ||
| Scalar max() const { |
Contributor
Author
There was a problem hiding this comment.
Is this correct, or do we need to do max of right->max() and everything in this tree node?
Owner
|
It's time to implement tests for this kind of question.
…On Fri, Apr 13, 2018, 21:49 Ben FrantzDale ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In IntervalTree.h
<#21 (comment)>:
> @@ -158,6 +158,18 @@ class IntervalTree {
assert(is_valid().first);
}
+ Scalar min() const {
+ assert(!empty());
+ if (left) { return left->min(); }
+ return std::min_element(intervals.begin(), intervals.end(),
+ IntervalStartCmp())->start;
+ }
+ Scalar max() const {
Is this right, or do we need to do max of right->max() and everything in
this tree node?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAI4ESWTh5OdZKQi5JVOf1qNdVlSzc2dks5toQFGgaJpZM4TT6xC>
.
|
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.