Skip to content

Commit

Permalink
Try amalgamate again.
Browse files Browse the repository at this point in the history
There seems to be some issues or inconsistencies with the astyle
version 3.2.1 from the AUR versus 3.2.1-build from apt:
   * --squeeze-lines is not defined in the one from Arch, so I had to
     comment that one out in order to make the amalgamate step run.
   * A bunch of files are affected by the amalgamate, which does not
     seem right.
  • Loading branch information
fsandhei committed Oct 9, 2023
1 parent 828bac9 commit ca40711
Show file tree
Hide file tree
Showing 11 changed files with 593 additions and 550 deletions.
2 changes: 1 addition & 1 deletion include/nlohmann/detail/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class exception : public std::exception
}

auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
[](const std::string & a, const std::string & b)
[](const std::string& a, const std::string& b)
{
return concat(a, '/', detail::escape(b));
});
Expand Down
2 changes: 1 addition & 1 deletion include/nlohmann/detail/iterators/iterator_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct iterator_traits

template<typename T>
struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
: iterator_types<T>
: iterator_types<T>
{
};

Expand Down
8 changes: 4 additions & 4 deletions include/nlohmann/detail/meta/is_sax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ using parse_error_function_t = decltype(std::declval<T&>().parse_error(
template<typename SAX, typename BasicJsonType>
struct is_sax
{
private:
private:
static_assert(is_basic_json<BasicJsonType>::value,
"BasicJsonType must be of type basic_json<...>");

Expand All @@ -84,7 +84,7 @@ struct is_sax
using binary_t = typename BasicJsonType::binary_t;
using exception_t = typename BasicJsonType::exception;

public:
public:
static constexpr bool value =
is_detected_exact<bool, null_function_t, SAX>::value &&
is_detected_exact<bool, boolean_function_t, SAX>::value &&
Expand All @@ -104,7 +104,7 @@ struct is_sax
template<typename SAX, typename BasicJsonType>
struct is_sax_static_asserts
{
private:
private:
static_assert(is_basic_json<BasicJsonType>::value,
"BasicJsonType must be of type basic_json<...>");

Expand All @@ -115,7 +115,7 @@ struct is_sax_static_asserts
using binary_t = typename BasicJsonType::binary_t;
using exception_t = typename BasicJsonType::exception;

public:
public:
static_assert(is_detected_exact<bool, null_function_t, SAX>::value,
"Missing/invalid function: bool null()");
static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,
Expand Down
62 changes: 31 additions & 31 deletions include/nlohmann/detail/meta/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ template<class...> struct conjunction : std::true_type { };
template<class B> struct conjunction<B> : B { };
template<class B, class... Bn>
struct conjunction<B, Bn...>
: std::conditional<static_cast<bool>(B::value), conjunction<Bn...>, B>::type {};
: std::conditional<static_cast<bool>(B::value), conjunction<Bn...>, B>::type {};

// https://en.cppreference.com/w/cpp/types/negation
template<class B> struct negation : std::integral_constant < bool, !B::value > { };
Expand All @@ -203,19 +203,19 @@ struct is_default_constructible : std::is_default_constructible<T> {};

template <typename T1, typename T2>
struct is_default_constructible<std::pair<T1, T2>>
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};

template <typename T1, typename T2>
struct is_default_constructible<const std::pair<T1, T2>>
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};

template <typename... Ts>
struct is_default_constructible<std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {};
: conjunction<is_default_constructible<Ts>...> {};

template <typename... Ts>
struct is_default_constructible<const std::tuple<Ts...>>
: conjunction<is_default_constructible<Ts>...> {};
: conjunction<is_default_constructible<Ts>...> {};

template <typename T, typename... Args>
struct is_constructible : std::is_constructible<T, Args...> {};
Expand All @@ -238,10 +238,10 @@ struct is_iterator_traits : std::false_type {};
template<typename T>
struct is_iterator_traits<iterator_traits<T>>
{
private:
private:
using traits = iterator_traits<T>;

public:
public:
static constexpr auto value =
is_detected<value_type_t, traits>::value &&
is_detected<difference_type_t, traits>::value &&
Expand All @@ -253,7 +253,7 @@ struct is_iterator_traits<iterator_traits<T>>
template<typename T>
struct is_range
{
private:
private:
using t_ref = typename std::add_lvalue_reference<T>::type;

using iterator = detected_t<result_of_begin, t_ref>;
Expand All @@ -265,7 +265,7 @@ struct is_range
static constexpr auto is_iterator_begin =
is_iterator_traits<iterator_traits<iterator>>::value;

public:
public:
static constexpr bool value = !std::is_same<iterator, nonesuch>::value && !std::is_same<sentinel, nonesuch>::value && is_iterator_begin;
};

Expand Down Expand Up @@ -307,7 +307,7 @@ struct is_compatible_object_type_impl <

template<typename BasicJsonType, typename CompatibleObjectType>
struct is_compatible_object_type
: is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};
: is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};

template<typename BasicJsonType, typename ConstructibleObjectType,
typename = void>
Expand Down Expand Up @@ -339,8 +339,8 @@ struct is_constructible_object_type_impl <

template<typename BasicJsonType, typename ConstructibleObjectType>
struct is_constructible_object_type
: is_constructible_object_type_impl<BasicJsonType,
ConstructibleObjectType> {};
: is_constructible_object_type_impl<BasicJsonType,
ConstructibleObjectType> {};

template<typename BasicJsonType, typename CompatibleStringType>
struct is_compatible_string_type
Expand Down Expand Up @@ -386,7 +386,7 @@ struct is_compatible_array_type_impl <

template<typename BasicJsonType, typename CompatibleArrayType>
struct is_compatible_array_type
: is_compatible_array_type_impl<BasicJsonType, CompatibleArrayType> {};
: is_compatible_array_type_impl<BasicJsonType, CompatibleArrayType> {};

template<typename BasicJsonType, typename ConstructibleArrayType, typename = void>
struct is_constructible_array_type_impl : std::false_type {};
Expand All @@ -396,7 +396,7 @@ struct is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t<std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value >>
: std::true_type {};
: std::true_type {};

template<typename BasicJsonType, typename ConstructibleArrayType>
struct is_constructible_array_type_impl <
Expand All @@ -415,22 +415,22 @@ is_detected<range_value_t, ConstructibleArrayType>::value&&
!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&&
is_complete_type <
detected_t<range_value_t, ConstructibleArrayType >>::value >>
{
using value_type = range_value_t<ConstructibleArrayType>;

static constexpr bool value =
std::is_same<value_type,
typename BasicJsonType::array_t::value_type>::value ||
has_from_json<BasicJsonType,
value_type>::value ||
has_non_default_from_json <
BasicJsonType,
value_type >::value;
};
{
using value_type = range_value_t<ConstructibleArrayType>;

static constexpr bool value =
std::is_same<value_type,
typename BasicJsonType::array_t::value_type>::value ||
has_from_json<BasicJsonType,
value_type>::value ||
has_non_default_from_json <
BasicJsonType,
value_type >::value;
};

template<typename BasicJsonType, typename ConstructibleArrayType>
struct is_constructible_array_type
: is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {};
: is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {};

template<typename RealIntegerType, typename CompatibleNumberIntegerType,
typename = void>
Expand All @@ -456,8 +456,8 @@ struct is_compatible_integer_type_impl <

template<typename RealIntegerType, typename CompatibleNumberIntegerType>
struct is_compatible_integer_type
: is_compatible_integer_type_impl<RealIntegerType,
CompatibleNumberIntegerType> {};
: is_compatible_integer_type_impl<RealIntegerType,
CompatibleNumberIntegerType> {};

template<typename BasicJsonType, typename CompatibleType, typename = void>
struct is_compatible_type_impl: std::false_type {};
Expand All @@ -473,7 +473,7 @@ struct is_compatible_type_impl <

template<typename BasicJsonType, typename CompatibleType>
struct is_compatible_type
: is_compatible_type_impl<BasicJsonType, CompatibleType> {};
: is_compatible_type_impl<BasicJsonType, CompatibleType> {};

template<typename T1, typename T2>
struct is_constructible_tuple : std::false_type {};
Expand Down Expand Up @@ -509,7 +509,7 @@ template<typename Compare, typename A, typename B>
struct is_comparable<Compare, A, B, void_t<
decltype(std::declval<Compare>()(std::declval<A>(), std::declval<B>())),
decltype(std::declval<Compare>()(std::declval<B>(), std::declval<A>()))
>> : std::true_type {};
>> : std::true_type {};

template<typename T>
using detect_is_transparent = typename T::is_transparent;
Expand Down
16 changes: 8 additions & 8 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4701,7 +4701,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// the valid JSON Patch operations
enum class patch_operations {add, remove, replace, move, copy, test, invalid};

const auto get_op = [](const std::string & op)
const auto get_op = [](const std::string& op)
{
if (op == "add")
{
Expand Down Expand Up @@ -4838,8 +4838,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
for (const auto& val : json_patch)
{
// wrapper to get a value for an operation
const auto get_value = [&val](const std::string & op,
const std::string & member,
const auto get_value = [&val](const std::string& op,
const std::string& member,
bool string_type) -> basic_json &
{
// find value
Expand Down Expand Up @@ -5216,14 +5216,14 @@ struct less< ::nlohmann::detail::value_t> // do not remove the space after '<',
*/
bool operator()(::nlohmann::detail::value_t lhs,
::nlohmann::detail::value_t rhs) const noexcept
{
{
#if JSON_HAS_THREE_WAY_COMPARISON
return std::is_lt(lhs <=> rhs); // *NOPAD*
return std::is_lt(lhs <=> rhs); // *NOPAD*
#else
return ::nlohmann::detail::operator<(lhs, rhs);
return ::nlohmann::detail::operator<(lhs, rhs);
#endif
}
};
}
};

// C++20 prohibit function specialization in the std namespace.
#ifndef JSON_HAS_CPP_20
Expand Down
Loading

0 comments on commit ca40711

Please sign in to comment.