You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function provides the interface to the used input adapter. It does
12066
+
not throw in case the input reached EOF, but returns false instead
12067
+
12068
+
@return bool, whether the read was successful
12069
+
*/
12070
+
template<class T>
12071
+
bool get_to(T& dest, const input_format_t format, const char* context)
12072
+
{
12073
+
auto new_chars_read = ia.get_elements(&dest);
12074
+
chars_read += new_chars_read;
12075
+
if (JSON_HEDLEY_UNLIKELY(new_chars_read < sizeof(T)))
12076
+
{
12077
+
// in case of failure, advance position by 1 to report failing location
12078
+
++chars_read;
12079
+
sax->parse_error(chars_read, "<end of file>", parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context), nullptr));
12080
+
return false;
12081
+
}
12082
+
return true;
12083
+
}
12084
+
12010
12085
/*!
12011
12086
@return character read from the input after ignoring all 'N' entries
12012
12087
*/
@@ -12021,6 +12096,28 @@ class binary_reader
12021
12096
return current;
12022
12097
}
12023
12098
12099
+
template<class NumberType>
12100
+
static void byte_swap(NumberType& number)
12101
+
{
12102
+
constexpr std::size_t sz = sizeof(number);
12103
+
#ifdef __cpp_lib_byteswap
12104
+
if constexpr (sz == 1)
12105
+
{
12106
+
return;
12107
+
}
12108
+
// convert float types to int types of the same size
0 commit comments