An ordered map with 4-byte links, like std::map without the allocator parameter and node handles.
Declared in <cptr/ordered_map.hpp>
template<
class K,
class V,
class Compare = std::less<K>,
class Cage = default_cage>
using ordered_map = detail::basic_ordered_map<K, V, Compare, Cage, true>;
A red-black tree whose nodes are allocated in Cage: 24 bytes per element for 4-byte keys and values, against 48 for std::map. The members behave like those of std::map, with these differences: there is no allocator parameter, no node handles (extract, merge, insert of a node) and no get_allocator(); hints are accepted but not used, so a hinted insertion costs a full search; and copy assignment gives the strong guarantee. See detail::basic_ordered_map for the full member list. Lookup is heterogeneous when Compare::is_transparent exists; so is erase, C++23 style, when CPTR_HETEROGENEOUS_ERASE is defined.
#include "cptr/ordered_map.hpp"
cptr::ordered_map<int, std::string> m;
m[2] = "two";
m.emplace(1, "one");
for (auto& [key, value] : m) { /* in key order */ }