@@ -199,7 +199,7 @@ template<typename CharType> struct basic_json
199
199
: parent_value_(&value), index_{ index }
200
200
{}
201
201
202
- constexpr const basic_json &operator *() const noexcept
202
+ constexpr const basic_json &operator *() const
203
203
{
204
204
if (parent_value_->is_array ()) {
205
205
return (*parent_value_)[index_];
@@ -340,7 +340,7 @@ template<typename CharType> struct basic_json
340
340
}
341
341
}
342
342
343
- template <typename Key>[[nodiscard]] constexpr std::size_t count (const Key &key) const noexcept
343
+ template <typename Key>[[nodiscard]] constexpr std::size_t count (const Key &key) const
344
344
{
345
345
if (is_object ()) {
346
346
const auto found = find (key);
@@ -353,7 +353,7 @@ template<typename CharType> struct basic_json
353
353
return 0 ;
354
354
}
355
355
356
- [[nodiscard]] constexpr iterator find (const std::basic_string_view<CharType> key) const noexcept
356
+ [[nodiscard]] constexpr iterator find (const std::basic_string_view<CharType> key) const
357
357
{
358
358
for (auto itr = begin (); itr != end (); ++itr) {
359
359
if (itr.key () == key) { return itr; }
@@ -392,7 +392,8 @@ template<typename CharType> struct basic_json
392
392
{
393
393
// I don't like this level of implicit conversions in the `get()` function,
394
394
// but it's necessary for API compatibility with nlohmann::json
395
- if constexpr (std::is_same_v<Type, std::uint64_t > || std::is_same_v<Type, std::int64_t > || std::is_same_v<Type, double >) {
395
+ if constexpr (std::is_same_v<Type,
396
+ std::uint64_t > || std::is_same_v<Type, std::int64_t > || std::is_same_v<Type, double >) {
396
397
if (const auto *uint_value = data.get_if_uinteger (); uint_value != nullptr ) {
397
398
return Type (*uint_value);
398
399
} else if (const auto *value = data.get_if_integer (); value != nullptr ) {
@@ -404,19 +405,20 @@ template<typename CharType> struct basic_json
404
405
}
405
406
} else if constexpr (std::is_same_v<Type,
406
407
std::basic_string_view<CharType>> || std::is_same_v<Type, std::basic_string<CharType>>) {
407
- if (const auto *value = data.get_if_string (); value != nullptr ) { return *value; }
408
- else {
408
+ if (const auto *value = data.get_if_string (); value != nullptr ) {
409
+ return *value;
410
+ } else {
409
411
throw std::runtime_error (" Unexpected type: string-like requested" );
410
412
}
411
413
} else if constexpr (std::is_same_v<Type, bool >) {
412
- if (const auto *value = data.get_if_boolean (); value != nullptr ) { return *value; }
413
- else {
414
+ if (const auto *value = data.get_if_boolean (); value != nullptr ) {
415
+ return *value;
416
+ } else {
414
417
throw std::runtime_error (" Unexpected type: bool requested" );
415
418
}
416
419
} else {
417
420
throw std::runtime_error (" Unexpected type for get()" );
418
421
}
419
-
420
422
}
421
423
422
424
[[nodiscard]] constexpr bool is_object () const noexcept { return data.selected == data_t ::selected_type::object; }
0 commit comments