Add helper types to make it easier to create a basic_json type with modified template parameters

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
barcode
2026-10-04 18:00:36 +02:00
committed by Niels Lohmann
parent 8c1f60a45e
commit c7a0d59e16
7 changed files with 127 additions and 77 deletions
+2 -27
View File
@@ -38,20 +38,7 @@ class json_metadata
};
template<class T>
using json_with_metadata =
nlohmann::basic_json <
std::map,
std::vector,
std::string,
bool,
std::int64_t,
std::uint64_t,
double,
std::allocator,
nlohmann::adl_serializer,
std::vector<std::uint8_t>,
json_metadata<T>
>;
using json_with_metadata = nlohmann::json::with_changed_base_class_t<json_metadata<T>>;
TEST_CASE("JSON Node Metadata")
{
@@ -268,19 +255,7 @@ class visitor_adaptor
void do_visit(const Ptr& ptr, const Fnc& fnc) const;
};
using json_with_visitor_t = nlohmann::basic_json <
std::map,
std::vector,
std::string,
bool,
std::int64_t,
std::uint64_t,
double,
std::allocator,
nlohmann::adl_serializer,
std::vector<std::uint8_t>,
visitor_adaptor
>;
using json_with_visitor_t = nlohmann::json::with_changed_base_class_t<visitor_adaptor>;
template <class Fnc>
void visitor_adaptor::visit(const Fnc& fnc) const