It seems json5pp can't be used with int64_t (long in Linux, long long in Windows) by default, generating this error:
error: conversion from ‘int64_t’ {aka ‘long int’} to ‘const json5pp::value’ is ambiguous
../../json5pp/json5pp.hpp:179:3: note: candidate: ‘json5pp::value::value(json5pp::value::integer_type)’
179 | value(integer_type integer) noexcept : type(TYPE_INTEGER), content(integer) {}
| ^~~~~
../../json5pp/json5pp.hpp:173:3: note: candidate: ‘json5pp::value::value(json5pp::value::number_type)’
173 | value(number_type number) noexcept : type(TYPE_NUMBER), content(number) {}
| ^~~~~
../../json5pp/json5pp.hpp:167:3: note: candidate: ‘json5pp::value::value(json5pp::value::boolean_type)’
167 | value(boolean_type boolean) noexcept : type(TYPE_BOOLEAN), content(boolean) {}
| ^~~~~
It seems json5pp's integer_type is int. Not sure if there's a way to accommodate every integer types.
For now I need to explicitly specify a larger integer type in the header for 64-bit integers. In my case, changing this:
using integer_type: int;
to
using integer_type: long long;
would enable me to use it with long long type to accommodate 64-bit integers. However, this has a price: all integers must be explicitly cast to long long regardless, and immediate values, like 0, need to be written as 0LL.
It seems json5pp can't be used with int64_t (long in Linux, long long in Windows) by default, generating this error:
error: conversion from ‘int64_t’ {aka ‘long int’} to ‘const json5pp::value’ is ambiguousIt seems json5pp's integer_type is int. Not sure if there's a way to accommodate every integer types.
For now I need to explicitly specify a larger integer type in the header for 64-bit integers. In my case, changing this:
using integer_type: int;to
using integer_type: long long;would enable me to use it with
long longtype to accommodate 64-bit integers. However, this has a price: all integers must be explicitly cast tolong longregardless, and immediate values, like0, need to be written as0LL.