From 49f26a02509d70a6f3cda614f4b0a272e7011978 Mon Sep 17 00:00:00 2001 From: gatopeich <gatoguan-os@yahoo.com> Date: Mon, 29 Jun 2020 17:32:55 +0100 Subject: [PATCH] Have 4 template parameters for ordered_map --- include/nlohmann/ordered_map.hpp | 6 +++--- single_include/nlohmann/json.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index 58c54845..672eb31e 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -11,10 +11,10 @@ namespace nlohmann /// ordered_map: a minimal map-like container that preserves insertion order /// for use within nlohmann::basic_json<ordered_map> template <class Key, class T, class IgnoredLess = std::less<Key>, - class Allocator = std::allocator<std::pair<const Key, T>>, - class Container = std::vector<std::pair<const Key, T>, Allocator>> -struct ordered_map : Container + class Allocator = std::allocator<std::pair<const Key, T>>> +struct ordered_map : std::vector<typename Allocator::value_type, Allocator> { + using Container = std::vector<typename Allocator::value_type, Allocator>; using key_type = Key; using mapped_type = T; using typename Container::iterator; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 937d5b0e..0f8d48bd 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2773,7 +2773,7 @@ uses the standard template types. */ using json = basic_json<>; -template<class Key, class T, class IgnoredLess, class Allocator, class Container> +template<class Key, class T, class IgnoredLess, class Allocator> struct ordered_map; /*! @@ -15880,10 +15880,10 @@ namespace nlohmann /// ordered_map: a minimal map-like container that preserves insertion order /// for use within nlohmann::basic_json<ordered_map> template <class Key, class T, class IgnoredLess = std::less<Key>, - class Allocator = std::allocator<std::pair<const Key, T>>, - class Container = std::vector<std::pair<const Key, T>, Allocator>> -struct ordered_map : Container + class Allocator = std::allocator<std::pair<const Key, T>>> +struct ordered_map : std::vector<typename Allocator::value_type, Allocator> { + using Container = std::vector<typename Allocator::value_type, Allocator>; using key_type = Key; using mapped_type = T; using typename Container::iterator;