Skip to content

[wpimath] Add accessors for min/max keys in InterpolatingTreeMap#8610

Open
pjreiniger wants to merge 4 commits intowpilibsuite:mainfrom
bzlmodRio:itm_min_max_keys
Open

[wpimath] Add accessors for min/max keys in InterpolatingTreeMap#8610
pjreiniger wants to merge 4 commits intowpilibsuite:mainfrom
bzlmodRio:itm_min_max_keys

Conversation

@pjreiniger
Copy link
Contributor

My team is using InterpolatingDoubleTreeMap and 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

@pjreiniger pjreiniger requested review from a team and PeterJohnson as code owners February 11, 2026 05:02
@github-actions github-actions bot added component: wpiutil Utility library component: wpimath Math library labels Feb 11, 2026
*
* @return The minimum key.
*/
Key minKey() const { return m_container.begin()->first; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a certain point that feels more like you should just use a map and have a free function that interpolates it

pjreiniger and others added 2 commits February 13, 2026 00:34
…latingTreeMap.java

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: wpimath Math library component: wpiutil Utility library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants