mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
Fix JSON_IMPL macro to avoid extraneous copies
Should take the thing we're serializing by reference.
This commit is contained in:
parent
d9de675357
commit
af71a9dbd9
7 changed files with 17 additions and 17 deletions
|
|
@ -4,13 +4,13 @@
|
|||
#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); \
|
||||
}; \
|
||||
#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, const TYPE & t); \
|
||||
}; \
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue