-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed compile error for #1045 #1134
Merged
+82
−3
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1516,6 +1516,16 @@ void to_json(BasicJsonType& j, const std::pair<Args...>& p) | |
j = {p.first, p.second}; | ||
} | ||
|
||
template<typename IteratorType> class iteration_proxy; // TODO: Forward decl needed, maybe move somewhere else | ||
template<typename BasicJsonType, typename T, | ||
enable_if_t<std::is_same<T, typename iteration_proxy<typename BasicJsonType::iterator>::iteration_proxy_internal>::value, int> = 0> | ||
void to_json(BasicJsonType& j, T b) noexcept | ||
{ | ||
typename BasicJsonType::object_t tmp_obj; | ||
tmp_obj[b.key()] = b.value(); // TODO: maybe there is a better way? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have a look at this later. |
||
external_constructor<value_t::object>::construct(j, std::move(tmp_obj)); | ||
} | ||
|
||
template<typename BasicJsonType, typename Tuple, std::size_t... Idx> | ||
void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence<Idx...>) | ||
{ | ||
|
@@ -4491,6 +4501,7 @@ class iter_impl | |
|
||
#include <cstddef> // size_t | ||
#include <string> // string, to_string | ||
#include <iterator> // input_iterator_tag | ||
|
||
// #include <nlohmann/detail/value_t.hpp> | ||
|
||
|
@@ -4506,6 +4517,13 @@ template<typename IteratorType> class iteration_proxy | |
/// helper class for iteration | ||
class iteration_proxy_internal | ||
{ | ||
public: | ||
using difference_type = std::ptrdiff_t; | ||
using value_type = iteration_proxy_internal; | ||
using pointer = iteration_proxy_internal*; | ||
using reference = iteration_proxy_internal&; | ||
using iterator_category = std::input_iterator_tag; | ||
|
||
private: | ||
/// the iterator | ||
IteratorType anchor; | ||
|
@@ -4515,6 +4533,9 @@ template<typename IteratorType> class iteration_proxy | |
public: | ||
explicit iteration_proxy_internal(IteratorType it) noexcept : anchor(it) {} | ||
|
||
iteration_proxy_internal(const iteration_proxy_internal&) = default; | ||
iteration_proxy_internal& operator=(const iteration_proxy_internal&) = default; | ||
|
||
/// dereference operator (needed for range-based for) | ||
iteration_proxy_internal& operator*() | ||
{ | ||
|
@@ -4530,6 +4551,12 @@ template<typename IteratorType> class iteration_proxy | |
return *this; | ||
} | ||
|
||
/// equality operator (needed for InputIterator) | ||
bool operator==(const iteration_proxy_internal& o) const noexcept | ||
{ | ||
return anchor == o.anchor; | ||
} | ||
|
||
/// inequality operator (needed for range-based for) | ||
bool operator!=(const iteration_proxy_internal& o) const noexcept | ||
{ | ||
|
@@ -7376,7 +7403,7 @@ boundaries compute_boundaries(FloatType value) | |
constexpr int kMinExp = 1 - kBias; | ||
constexpr uint64_t kHiddenBit = uint64_t{1} << (kPrecision - 1); // = 2^(p-1) | ||
|
||
using bits_type = typename std::conditional< kPrecision == 24, uint32_t, uint64_t >::type; | ||
using bits_type = typename std::conditional<kPrecision == 24, uint32_t, uint64_t>::type; | ||
|
||
const uint64_t bits = reinterpret_bits<bits_type>(value); | ||
const uint64_t E = bits >> (kPrecision - 1); | ||
|
@@ -7787,7 +7814,10 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, | |
// = ((p1 ) * 2^-e + (p2 )) * 2^e | ||
// = p1 + p2 * 2^e | ||
|
||
const diyfp one(uint64_t{1} << -M_plus.e, M_plus.e); | ||
const diyfp one(uint64_t | ||
{ | ||
1 | ||
} << -M_plus.e, M_plus.e); | ||
|
||
uint32_t p1 = static_cast<uint32_t>(M_plus.f >> -one.e); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.) | ||
uint64_t p2 = M_plus.f & (one.f - 1); // p2 = f mod 2^-e | ||
|
@@ -17251,7 +17281,7 @@ struct hash<nlohmann::json> | |
/// @note: do not remove the space after '<', | ||
/// see https://github.com/nlohmann/json/pull/679 | ||
template<> | ||
struct less< ::nlohmann::detail::value_t> | ||
struct less<::nlohmann::detail::value_t> | ||
{ | ||
/*! | ||
@brief compare two value_t enum values | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look at this later.