forked from lix-project/lix
5ba6e5d0d9
This forces us to be explicit. It also requires to rework how `from_json` works. A `JSON_IMPL` is added to assist with this.
15 lines
750 B
C++
15 lines
750 B
C++
#pragma once
|
|
|
|
#include "nlohmann/json_fwd.hpp"
|
|
|
|
// Following https://github.com/nlohmann/json#how-can-i-use-get-for-non-default-constructiblenon-copyable-types
|
|
#define JSON_IMPL(TYPE) \
|
|
namespace nlohmann { \
|
|
using namespace nix; \
|
|
template <> \
|
|
struct adl_serializer<TYPE> { \
|
|
static TYPE from_json(const json & json); \
|
|
static void to_json(json & json, TYPE t); \
|
|
}; \
|
|
}
|