add static_asserts on SAX interface
This commit is contained in:
parent
38f8a51a8f
commit
0cc3db4f15
4 changed files with 361 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include <nlohmann/detail/input/json_sax.hpp>
|
||||
#include <nlohmann/detail/exceptions.hpp>
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
#include <nlohmann/detail/meta/is_sax.hpp>
|
||||
#include <nlohmann/detail/value_t.hpp>
|
||||
|
||||
namespace nlohmann
|
||||
|
|
@ -47,6 +48,7 @@ class binary_reader
|
|||
*/
|
||||
explicit binary_reader(input_adapter_t adapter) : ia(std::move(adapter))
|
||||
{
|
||||
(void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
|
||||
assert(ia);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <nlohmann/detail/exceptions.hpp>
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
#include <nlohmann/detail/meta/is_sax.hpp>
|
||||
#include <nlohmann/detail/input/input_adapters.hpp>
|
||||
#include <nlohmann/detail/input/json_sax.hpp>
|
||||
#include <nlohmann/detail/input/lexer.hpp>
|
||||
|
|
@ -145,6 +146,7 @@ class parser
|
|||
template <typename SAX>
|
||||
bool sax_parse(SAX* sax, const bool strict = true)
|
||||
{
|
||||
(void)detail::is_sax_static_asserts<SAX, BasicJsonType>{};
|
||||
const bool result = sax_parse_internal(sax);
|
||||
|
||||
// strict mode: next byte must be EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue