Skip to content

Commit 2641464

Browse files
author
Théo Delrieu
committed
optional: use #if instead of #ifndef, fixes #3859
1 parent a006a7a commit 2641464

File tree

3 files changed

+569
-569
lines changed

3 files changed

+569
-569
lines changed

include/nlohmann/detail/conversions/from_json.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ inline void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
4848
}
4949

5050
#ifdef JSON_HAS_CPP_17
51-
#ifndef JSON_USE_IMPLICIT_CONVERSIONS
51+
#if !JSON_USE_IMPLICIT_CONVERSIONS
5252
template<typename BasicJsonType, typename T>
5353
void from_json(const BasicJsonType& j, std::optional<T>& opt)
5454
{
@@ -297,13 +297,13 @@ void())
297297

298298
template < typename BasicJsonType, typename T, std::size_t... Idx >
299299
std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j,
300-
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
300+
identity_tag<std::array<T, sizeof...(Idx) >> /*unused*/, index_sequence<Idx...> /*unused*/)
301301
{
302302
return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };
303303
}
304304

305305
template < typename BasicJsonType, typename T, std::size_t N >
306-
auto from_json(BasicJsonType&& j, identity_tag<std::array<T, N>> tag)
306+
auto from_json(BasicJsonType&& j, identity_tag<std::array<T, N >> tag)
307307
-> decltype(from_json_inplace_array_impl(std::forward<BasicJsonType>(j), tag, make_index_sequence<N> {}))
308308
{
309309
if (JSON_HEDLEY_UNLIKELY(!j.is_array()))
@@ -402,7 +402,7 @@ std::tuple<Args...> from_json_tuple_impl_base(BasicJsonType&& j, index_sequence<
402402
}
403403

404404
template < typename BasicJsonType, class A1, class A2 >
405-
std::pair<A1, A2> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::pair<A1, A2>> /*unused*/, priority_tag<0> /*unused*/)
405+
std::pair<A1, A2> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::pair<A1, A2 >> /*unused*/, priority_tag<0> /*unused*/)
406406
{
407407
return {std::forward<BasicJsonType>(j).at(0).template get<A1>(),
408408
std::forward<BasicJsonType>(j).at(1).template get<A2>()};
@@ -411,11 +411,11 @@ std::pair<A1, A2> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::pair
411411
template<typename BasicJsonType, typename A1, typename A2>
412412
inline void from_json_tuple_impl(BasicJsonType&& j, std::pair<A1, A2>& p, priority_tag<1> /*unused*/)
413413
{
414-
p = from_json_tuple_impl(std::forward<BasicJsonType>(j), identity_tag<std::pair<A1, A2>> {}, priority_tag<0> {});
414+
p = from_json_tuple_impl(std::forward<BasicJsonType>(j), identity_tag<std::pair<A1, A2 >> {}, priority_tag<0> {});
415415
}
416416

417417
template<typename BasicJsonType, typename... Args>
418-
std::tuple<Args...> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::tuple<Args...>> /*unused*/, priority_tag<2> /*unused*/)
418+
std::tuple<Args...> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::tuple<Args... >> /*unused*/, priority_tag<2> /*unused*/)
419419
{
420420
return from_json_tuple_impl_base<BasicJsonType, Args...>(std::forward<BasicJsonType>(j), index_sequence_for<Args...> {});
421421
}
@@ -493,7 +493,7 @@ inline void from_json(const BasicJsonType& j, std_fs::path& p)
493493
struct from_json_fn
494494
{
495495
template<typename BasicJsonType, typename T>
496-
auto operator()(const BasicJsonType& j, T&& val) const
496+
auto operator()(const BasicJsonType & j, T&& val) const
497497
noexcept(noexcept(from_json(j, std::forward<T>(val))))
498498
-> decltype(from_json(j, std::forward<T>(val)))
499499
{

0 commit comments

Comments
 (0)