Slick OrderBook 1.1.0
High-Performance C++23 OrderBook Library
Loading...
Searching...
No Matches
flat_map.hpp
Go to the documentation of this file.
1// Copyright 2026 Slick Quant
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
7#include <version>
8
9// Check for C++23 flat_map support
10#if defined(__cpp_lib_flat_map)
11 #include <flat_map>
12 #define SLICK_HAS_FLAT_MAP 1
13#else
14 #include <map>
15 #define SLICK_HAS_FLAT_MAP 0
16#endif
17
19
32#if SLICK_HAS_FLAT_MAP
33template<typename Key, typename Value, typename Compare = std::less<Key>>
34using FlatMap = std::flat_map<Key, Value, Compare>;
35#else
36template<typename Key, typename Value, typename Compare = std::less<Key>>
37using FlatMap = std::map<Key, Value, Compare>;
38#endif
39
#define SLICK_DETAIL_NAMESPACE_BEGIN
Definition config.hpp:129
#define SLICK_DETAIL_NAMESPACE_END
Definition config.hpp:130
std::map< Key, Value, Compare > FlatMap
Cache-friendly sorted map.
Definition flat_map.hpp:37