Skip to content

Commit

Permalink
🔨 adjust template parameters for ordered_map
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Nov 28, 2024
1 parent e41905f commit 8e0437b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
15 changes: 9 additions & 6 deletions include/nlohmann/json_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_

#include <cstdint> // int64_t, uint64_t
#include <functional> // less
#include <map> // map
#include <memory> // allocator
#include <string> // string
#include <utility> // pair
#include <vector> // vector

#include <nlohmann/detail/abi_macros.hpp>
Expand Down Expand Up @@ -63,13 +65,14 @@ using json = basic_json<>;

/// @brief a minimal map-like container that preserves insertion order
/// @sa https://json.nlohmann.me/api/ordered_map/
template<class Key, class T, class IgnoredLess, class Allocator>
struct ordered_map;
template<class Key, class T, class IgnoredLess = std::less<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>>
struct ordered_map;

/// @brief specialization that maintains the insertion order of object keys
/// @sa https://json.nlohmann.me/api/ordered_json/
using ordered_json = basic_json<nlohmann::ordered_map>;
/// @brief specialization that maintains the insertion order of object keys
/// @sa https://json.nlohmann.me/api/ordered_json/
using ordered_json = basic_json<nlohmann::ordered_map>;

NLOHMANN_JSON_NAMESPACE_END
NLOHMANN_JSON_NAMESPACE_END

#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
5 changes: 4 additions & 1 deletion single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3403,9 +3403,11 @@ NLOHMANN_JSON_NAMESPACE_END
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_

#include <cstdint> // int64_t, uint64_t
#include <functional> // less
#include <map> // map
#include <memory> // allocator
#include <string> // string
#include <utility> // pair
#include <vector> // vector

// #include <nlohmann/detail/abi_macros.hpp>
Expand Down Expand Up @@ -3457,7 +3459,8 @@ NLOHMANN_JSON_NAMESPACE_END

/// @brief a minimal map-like container that preserves insertion order
/// @sa https://json.nlohmann.me/api/ordered_map/
template<class Key, class T, class IgnoredLess, class Allocator>
template<class Key, class T, class IgnoredLess = std::less<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>>
struct ordered_map;

/// @brief specialization that maintains the insertion order of object keys
Expand Down
15 changes: 9 additions & 6 deletions single_include/nlohmann/json_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_

#include <cstdint> // int64_t, uint64_t
#include <functional> // less
#include <map> // map
#include <memory> // allocator
#include <string> // string
#include <utility> // pair
#include <vector> // vector

// #include <nlohmann/detail/abi_macros.hpp>
Expand Down Expand Up @@ -164,13 +166,14 @@ using json = basic_json<>;

/// @brief a minimal map-like container that preserves insertion order
/// @sa https://json.nlohmann.me/api/ordered_map/
template<class Key, class T, class IgnoredLess, class Allocator>
struct ordered_map;
template<class Key, class T, class IgnoredLess = std::less<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>>
struct ordered_map;

/// @brief specialization that maintains the insertion order of object keys
/// @sa https://json.nlohmann.me/api/ordered_json/
using ordered_json = basic_json<nlohmann::ordered_map>;
/// @brief specialization that maintains the insertion order of object keys
/// @sa https://json.nlohmann.me/api/ordered_json/
using ordered_json = basic_json<nlohmann::ordered_map>;

NLOHMANN_JSON_NAMESPACE_END
NLOHMANN_JSON_NAMESPACE_END

#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_

0 comments on commit 8e0437b

Please sign in to comment.