* Price levels are computed lazily * Once computed, a price level can be accessed in O(1) * Unit tests piggy back on rigorous existing unit tests in 'synthetic_book_computation' * Not integrated into the matcher, as that is non-trivial work, and the March 2021 roll is fast approaching
30 lines
780 B
C++
30 lines
780 B
C++
#pragma once
|
|
#include <boost/container/flat_map.hpp>
|
|
#include <unordered_map>
|
|
|
|
namespace bts {
|
|
|
|
struct MapUtils {
|
|
template <class K, class V>
|
|
static const V *find_value(const std::unordered_map<K, V> &, K);
|
|
|
|
template <class K, class V>
|
|
static V *find_value(std::unordered_map<K, V> &, K);
|
|
|
|
template <class K, class V>
|
|
static const V &assert_find_value(const std::unordered_map<K, V> &, K);
|
|
|
|
template <class K, class V>
|
|
static V &assert_find_value(std::unordered_map<K, V> &, K);
|
|
|
|
template <class K, class V>
|
|
static const V &assert_find_value(const boost::container::flat_map<K, V> &, K);
|
|
|
|
template <class K, class V>
|
|
static V &assert_find_value(boost::container::flat_map<K, V> &, K);
|
|
};
|
|
|
|
} // namespace bts
|
|
|
|
#include "MapUtils.cc"
|