experiment: changed order of parse functions

This commit is contained in:
Niels Lohmann 2016-08-24 07:12:56 +02:00 committed by GitHub
parent 1d66ab9f7a
commit 8b833c452a

View file

@ -5876,41 +5876,6 @@ class basic_json
/// @name deserialization
/// @{
/*!
@brief deserialize from string literal
@tparam CharT character/literal type with size of 1 byte
@param[in] s string literal to read a serialized JSON value from
@param[in] cb a parser callback function of type @ref parser_callback_t
which is used to control the deserialization by filtering unwanted values
(optional)
@return result of the deserialization
@complexity Linear in the length of the input. The parser is a predictive
LL(1) parser. The complexity can be higher if the parser callback function
@a cb has a super-linear complexity.
@note A UTF-8 byte order mark is silently ignored.
@note String containers like `std::string` or @ref string_t can be parsed
with @ref parse(const ContiguousContainer&, const parser_callback_t)
@liveexample{The example below demonstrates the `parse()` function with
and without callback function.,parse__string__parser_callback_t}
@sa @ref parse(std::istream&, const parser_callback_t) for a version that
reads from an input stream
@since version 1.0.0 (originally for @ref string_t)
*/
template<typename CharT, typename std::enable_if<
std::is_integral<CharT>::value and sizeof(CharT) == 1, int>::type = 0>
static basic_json parse(const CharT* s,
const parser_callback_t cb = nullptr)
{
return parser(reinterpret_cast<const char*>(s), cb).parse();
}
/*!
@brief deserialize from stream
@ -6073,6 +6038,41 @@ class basic_json
return parse(std::begin(c), std::end(c), cb);
}
/*!
@brief deserialize from string literal
@tparam CharT character/literal type with size of 1 byte
@param[in] s string literal to read a serialized JSON value from
@param[in] cb a parser callback function of type @ref parser_callback_t
which is used to control the deserialization by filtering unwanted values
(optional)
@return result of the deserialization
@complexity Linear in the length of the input. The parser is a predictive
LL(1) parser. The complexity can be higher if the parser callback function
@a cb has a super-linear complexity.
@note A UTF-8 byte order mark is silently ignored.
@note String containers like `std::string` or @ref string_t can be parsed
with @ref parse(const ContiguousContainer&, const parser_callback_t)
@liveexample{The example below demonstrates the `parse()` function with
and without callback function.,parse__string__parser_callback_t}
@sa @ref parse(std::istream&, const parser_callback_t) for a version that
reads from an input stream
@since version 1.0.0 (originally for @ref string_t)
*/
template<typename CharT, typename std::enable_if<
std::is_integral<CharT>::value and sizeof(CharT) == 1, int>::type = 0>
static basic_json parse(const CharT* s,
const parser_callback_t cb = nullptr)
{
return parser(reinterpret_cast<const char*>(s), cb).parse();
}
/*!
@brief deserialize from stream