From 25f5d75e6e0fbdbff1a6341b112156ecfc726812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20F=2E=20Pozuelo?= Date: Fri, 3 Jul 2020 01:44:18 +0100 Subject: [PATCH] Fix compilation for xcode 9.x --- include/nlohmann/json_fwd.hpp | 2 +- include/nlohmann/ordered_map.hpp | 4 +++- single_include/nlohmann/json.hpp | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/nlohmann/json_fwd.hpp b/include/nlohmann/json_fwd.hpp index d9e5428d..332227c1 100644 --- a/include/nlohmann/json_fwd.hpp +++ b/include/nlohmann/json_fwd.hpp @@ -61,7 +61,7 @@ uses the standard template types. */ using json = basic_json<>; -template +template struct ordered_map; /*! diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index 4a71951d..29c52016 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -22,11 +22,13 @@ struct ordered_map : std::vector, Allocator> using typename Container::value_type; // Explicit constructors instead of `using Container::Container` - // otherwise older compilers like GCC 5.5 choke on it + // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {} template ordered_map(It first, It last, const Allocator& alloc = Allocator()) : Container{first, last, alloc} {} + ordered_map(std::initializer_list init, const Allocator& alloc = Allocator() ) + : Container{init, alloc} {} std::pair emplace(key_type&& key, T&& t) { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e5e3bc3e..850ee6ab 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -15891,11 +15891,13 @@ struct ordered_map : std::vector, Allocator> using typename Container::value_type; // Explicit constructors instead of `using Container::Container` - // otherwise older compilers like GCC 5.5 choke on it + // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {} template ordered_map(It first, It last, const Allocator& alloc = Allocator()) : Container{first, last, alloc} {} + ordered_map(std::initializer_list init, const Allocator& alloc = Allocator() ) + : Container{init, alloc} {} std::pair emplace(key_type&& key, T&& t) {