[wpimath] Add accessors for min/max keys in InterpolatingTreeMap#8610
Open
pjreiniger wants to merge 4 commits intowpilibsuite:mainfrom
Open
[wpimath] Add accessors for min/max keys in InterpolatingTreeMap#8610pjreiniger wants to merge 4 commits intowpilibsuite:mainfrom
pjreiniger wants to merge 4 commits intowpilibsuite:mainfrom
Conversation
calcmogul
reviewed
Feb 11, 2026
wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingTreeMap.java
Outdated
Show resolved
Hide resolved
calcmogul
requested changes
Feb 13, 2026
wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingTreeMap.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingTreeMap.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingTreeMap.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingTreeMap.java
Outdated
Show resolved
Hide resolved
| * | ||
| * @return The minimum key. | ||
| */ | ||
| Key minKey() const { return m_container.begin()->first; } |
Member
There was a problem hiding this comment.
The more idiomatic way to do this is by exposing the iterators of the underlying container (begin(), cbegin(), end(), cend(), rbegin(), crbegin(), rend(), crend() from https://en.cppreference.com/w/cpp/container/map.html).
Contributor
Author
There was a problem hiding this comment.
At a certain point that feels more like you should just use a map and have a free function that interpolates it
…latingTreeMap.java Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
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.
My team is using
InterpolatingDoubleTreeMapand wanted to add indicators if we are currently too close/far given the values in our table. It would be convenient to be able to ask for the min/max key rather than have to have to make constants for the first and last pairs to be able to use elsewhere