22template <
typename Key,
typename Value>
32 m_container.insert(std::make_pair(key,
value));
42 m_container.insert(std::make_pair(key,
value));
54 using const_iterator =
typename std::map<Key, Value>::const_iterator;
57 const_iterator upper = m_container.upper_bound(key);
60 if (upper == m_container.end()) {
61 return (--upper)->second;
65 if (upper == m_container.begin()) {
70 const_iterator lower = upper;
74 const double delta = (key - lower->first) / (upper->first - lower->first);
75 return delta * upper->second + (1.0 - delta) * lower->second;
81 void clear() { m_container.clear(); }
84 std::map<Key, Value> m_container;
Implements a table of key-value pairs with linear interpolation between values.
Definition: interpolating_map.h:23
void insert(Key &&key, Value &&value)
Inserts a key-value pair.
Definition: interpolating_map.h:41
void clear()
Clears the contents.
Definition: interpolating_map.h:81
void insert(const Key &key, const Value &value)
Inserts a key-value pair.
Definition: interpolating_map.h:31
Value operator[](const Key &key) const
Returns the value associated with a given key.
Definition: interpolating_map.h:53
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18