Commit graph

61 commits

Author SHA1 Message Date
Théo DELRIEU
74b446f5fd
add a switch to enable implicit conversions (defaults to true)
wrap implicit conversions tests around the JSON_USE_IMPLICIT_CONVERSIONS
macro
2020-07-22 10:49:01 +02:00
Niels Lohmann
8d295235a5
🔥 remove unused boolean_operators.hpp header 2020-07-11 19:20:44 +02:00
Niels Lohmann
dc06f100be
Merge branch 'develop' of https://github.com/nlohmann/json into clang_windows
 Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	include/nlohmann/detail/input/json_sax.hpp
	include/nlohmann/detail/input/lexer.hpp
	include/nlohmann/detail/input/parser.hpp
	include/nlohmann/detail/json_pointer.hpp
	include/nlohmann/detail/output/serializer.hpp
	include/nlohmann/json.hpp
	single_include/nlohmann/json.hpp
2020-07-11 14:04:40 +02:00
Niels Lohmann
98b1c6d302
🚩 use JSON_ASSERT(x) instead of assert(x) 2020-07-06 12:22:31 +02:00
Niels Lohmann
0498202a03
🎨 replace alternative operators (and, not, or) 2020-06-03 14:20:36 +02:00
Niels Lohmann
904642f261
♻️ rename internal_binary_t with binary_t 2020-05-17 22:50:27 +02:00
Niels Lohmann
ab6e76dd05
Merge branches 'binary_type' and 'develop' of https://github.com/nlohmann/json into binary_type 2020-05-17 12:27:58 +02:00
Niels Lohmann
daf2d296dd
♻️ move wrapped binary type to separate file 2020-05-15 14:12:32 +02:00
Niels Lohmann
9adb1c0235
🏁 do not include <ciso646> unless old MSVC is used #2089 2020-05-07 09:43:41 +02:00
Niels Lohmann
4fb0795ec1
🚨 fix compiler warnings #2049 2020-04-19 13:01:36 +02:00
Niels Lohmann
69ac336042
Merge pull request #1967 from dota17/dota17-disable
Fix C26451 warnnings in to_chars.hpp
2020-04-17 10:08:21 +02:00
Michael Reilly
012c9665ac Add binary type support to all binary file formats, as well as an internally represented binary type 2020-04-14 10:22:45 -04:00
chenguoping
0a8216890d fix C26451 warnnings in to_chars.hpp 2020-03-23 15:27:35 +08:00
Niels Lohmann
62dada05ca
🐛 fix conversion to std::valarray
closes #1824
2019-11-05 19:28:00 +01:00
Camille Bégué
8b686b30eb Add restriction for tuple specialization of to_json
This commit fix the issue #1825

Signed-off-by: Camille Bégué <c.begue@samsung.com>
2019-11-04 09:57:16 +01:00
Niels Lohmann
a1828bbf57
Merge pull request #1806 from cbegue/develop
Fix issue #1805
2019-11-01 19:46:19 +01:00
Camille Bégué
794a3d411a Fix issue #1805
* Add some restriction on pair partial specialization of to_json

Signed-off-by: Camille Bégué <camille.begue.pro@gmail.com>
2019-10-31 18:04:15 +01:00
Florian Pigorsch
b93d414a35 Fix some spelling errors - mostly in comments & documentation.
I did not touch the Changelog file and any third party stuff.

additonal -> additional (1)
apppend -> append (2)
constuctor -> constructor (2)
contect -> context (2)
dobulequote -> doublequote (1)
elemnts -> elements (1)
exakt -> exact (2)
exluded -> exclude (1)
explicitely -> explicitly (2)
narcissic -> narcissistic (1)
ocurred -> occurred (1)
occuring -> occurring (2)
preceeds -> preceded (1)
ot -> to (2)
wehther -> whether (2)
2019-10-19 11:59:51 +02:00
Thomas Braun
d5c0d52f37 external_constructor<std::valarray>: Handle empty array properly
Clang UBSAN complains with the following message when an empty std::valarray is passed in:

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/valarray:571:14 in

2/2 Test #68: test-regression_all ..............***Failed    4.68 sec
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/valarray:571:14: runtime error: reference binding to null pointer of type 'const do
uble'
    #0 0x6fbe57 in std::valarray<double>::operator[](unsigned long) const /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/valarray:
571:7
    #1 0x6fbe57 in double const* std::begin<double>(std::valarray<double> const&) /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/v
alarray:1207
    #2 0x6fbe57 in void nlohmann::detail::external_constructor<(nlohmann::detail::value_t)2>::construct<nlohmann::basic_json<std::map, std::vector, s
td::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_seri
alizer>, double, 0>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool
, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&, std::valarray<double> const&) /home/firma/devel/json/include/nlohmann/deta
il/conversions/to_json.hpp:157
    #3 0x5e3fe3 in void nlohmann::detail::to_json<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>
, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>, double, 0>(nlohmann::basic_json<std::map, std
::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohman
n::adl_serializer>&, std::valarray<double> const&) /home/firma/devel/json/include/nlohmann/detail/conversions/to_json.hpp:270:5
    #4 0x5e3fe3 in decltype((to_json(fp, std::forward<std::valarray<double>&>(fp0))) , ((void)())) nlohmann::detail::to_json_fn::operator()<nlohmann:
:basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double
, std::allocator, nlohmann::adl_serializer>, std::valarray<double>&>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std
::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&, std::valarray<double>&) c
onst /home/firma/devel/json/include/nlohmann/detail/conversions/to_json.hpp:334
    #5 0x5e3fe3 in decltype((nlohmann::(anonymous namespace)::to_json(fp, std::forward<std::valarray<double>&>(fp0))) , ((void)())) nlohmann::adl_ser
ializer<std::valarray<double>, void>::to_json<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, st
d::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>, std::valarray<double>&>(nlohmann::basic_json<std:
:map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator
, nlohmann::adl_serializer>&, std::valarray<double>&) /home/firma/devel/json/include/nlohmann/adl_serializer.hpp:45
    #6 0x5e3fe3 in nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool,
 long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::basic_json<std::valarray<double>&, std::valarray<double>, 0>(std::valarray<d
ouble>&) /home/firma/devel/json/include/nlohmann/json.hpp:1257
    #7 0x5e3fe3 in _DOCTEST_ANON_FUNC_2() /home/firma/devel/json/test/src/unit-regression.cpp:1377
    #8 0x77313e in doctest::Context::run() /home/firma/devel/json/test/thirdparty/doctest/doctest.h:5938:21
    #9 0x777ae0 in main /home/firma/devel/json/test/thirdparty/doctest/doctest.h:6016:71
    #10 0x7fae220532e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #11 0x4a6479 in _start (/home/firma/devel/json/build/test/test-regression+0x4a6479)

The important thing to note here is that a std::valarray is *not* a STL
container, so the usual containter and iterator semantics don't apply.

Therefore we have to check if the container is non-empty before.
2019-09-03 13:22:03 +02:00
Niels Lohmann
90798caa62
🚚 rename Hedley macros 2019-07-01 22:37:30 +02:00
Niels Lohmann
897362191d
🔨 add NLOHMANN_JSON prefix and undef macros 2019-07-01 22:24:39 +02:00
Niels Lohmann
1720bfedd1
⚗️ add Hedley annotations 2019-06-30 22:14:02 +02:00
Théo DELRIEU
e6e6805c6c
add built-in array support in get_to 2019-04-01 17:47:45 +02:00
Théo DELRIEU
2806b201a8
make sure values are overwritten in from_json overloads
Caused unexpected behaviors when using get_to with values previously
set.

Fixes !1511
2019-04-01 17:47:42 +02:00
Niels Lohmann
9d6ab9014f
🏁 fixed a compilation error in MSVC #1531 2019-03-20 14:13:29 +01:00
Niels Lohmann
8d3f4f21bc
🔨 clean up 2019-03-18 13:53:48 +01:00
Niels Lohmann
b8451c236f
🚨 fixed warnings 2019-03-17 12:01:49 +01:00
Niels Lohmann
34f8b4f711
🚨 fixed more warnings 2019-03-17 00:27:44 +01:00
Niels Lohmann
8d6c033f80
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2019-03-15 14:55:15 +01:00
Niels Lohmann
27011e3718
🚨 fixed warnings 2019-03-15 14:55:13 +01:00
Ferenc Nasztanovics
0067ea8f9e Change macros to numeric_limits #1483 2019-03-13 23:44:34 +01:00
Niels Lohmann
5c04cc1009
🔨 fixed includes 2019-01-13 15:31:22 +01:00
Pratik Chowdhury
ebd3f45808 Added Support for Structured Bindings
For further details, read https://github.com/nlohmann/json/issues/1388 and https://blog.tartanllama.xyz/structured-bindings/
2018-12-19 20:17:52 +05:30
Théo DELRIEU
45c8af2c46
add new is_constructible_* traits used in from_json
is_compatible_* traits were used in from_json, but it made no sense
whatsoever.

It used to work because of non-SFINAE correctness + json_ref
unconstrained variadic template constructor.

SFINAE checks are becoming quite complex, we need a specification of
some sort describing:

* which concepts the library uses
* how the conversion to/from json works in detail

Having such a specification would really help simplifying the current
code (as well as having meaningful checks).

Fixes !1299
2018-10-16 14:00:34 +02:00
Niels Lohmann
858e75c4df
🚨 fixed some clang-tidy warnings 2018-10-07 18:39:18 +02:00
Niels Lohmann
ec95438a59
🚨 fixed some linter warnings 2018-10-06 13:49:02 +02:00
Niels Lohmann
ebb3c03293
🎨 cleanup after #1228 2018-09-09 18:19:33 +02:00
Théo DELRIEU
aea648bb7a
remove now-useless traits. check for is_basic_json where needed 2018-09-07 14:10:39 +02:00
Théo DELRIEU
4b4bbceebf
make from_json SFINAE-correct 2018-09-07 14:10:37 +02:00
Théo DELRIEU
f7971f04a5
make to_json SFINAE-correct 2018-09-07 12:18:04 +02:00
Théo DELRIEU
f7c8a2145a
refactor from/to_json(CompatibleArrayType) 2018-09-07 12:18:04 +02:00
Théo DELRIEU
628f76729e
do not check for compatible_object_type in compatible_array_type 2018-09-07 12:18:03 +02:00
Théo DELRIEU
f6febbe359
split meta.hpp, add detected_t (used to define concepts) 2018-08-16 11:58:42 +02:00
Niels Lohmann
347e77bdc1
🚑 fix for #1169 2018-07-21 10:31:55 +02:00
Niels Lohmann
39dd775e38
🔨 cleanup after #1134 2018-06-28 21:32:32 +02:00
Niels Lohmann
86a96b059d
Merge pull request #1134 from Daniel599/feature/items_iterator
fixed compile error for #1045
2018-06-28 21:21:17 +02:00
Julius Rakow
9f00db48d9 📝 link to cppreference via HTTPS 2018-06-24 22:34:47 +02:00
Niels Lohmann
7fa4ddf93e
💄 fixed indentation 2018-06-23 17:27:40 +02:00
Niels Lohmann
bf348ca8a4
Merge pull request #1028 from gracicot/develop
Added support for string_view in C++17
2018-06-23 17:10:04 +02:00
Niels Lohmann
66dd1a846d
🚨 fixed more compiler warnings 2018-06-23 10:47:55 +02:00