Merge pull request #2140 from nlohmann/issue1715

Respect allow_exceptions=false for binary formats
This commit is contained in:
Niels Lohmann 2020-05-28 07:52:26 +02:00 committed by GitHub
commit 9ec0e4c25b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 4 deletions

View file

@ -331,13 +331,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
return input_stream_adapter(stream);
}
template<typename CharT,
template<typename CharT, typename SizeT,
typename std::enable_if<
std::is_pointer<CharT>::value and
std::is_integral<typename std::remove_pointer<CharT>::type>::value and
not std::is_same<SizeT, bool>::value and
sizeof(typename std::remove_pointer<CharT>::type) == 1,
int>::type = 0>
input_buffer_adapter input_adapter(CharT b, std::size_t l)
input_buffer_adapter input_adapter(CharT b, SizeT l)
{
return input_buffer_adapter(reinterpret_cast<const char*>(b), l);
}