1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-13 20:21:48 +03:00

fix tests, avoid instantiating JSONSerializer when it will not be used

This commit is contained in:
Théo DELRIEU
2016-12-15 12:22:53 +01:00
parent d5ee5830ed
commit aa2679a8ce
2 changed files with 17 additions and 16 deletions

View File

@ -1614,13 +1614,14 @@ class basic_json
template <
typename T,
enable_if_t<not std::is_base_of<std::istream, uncvref_t<T>>::value and
not detail::is_compatible_basic_json_type<
uncvref_t<T>, basic_json_t>::value and
not detail::is_basic_json_nested_class<uncvref_t<T>, basic_json_t, primitive_iterator_t>::value and
not std::is_same<uncvref_t<T>, typename basic_json_t::array_t::iterator>::value and
not std::is_same<uncvref_t<T>, typename basic_json_t::object_t::iterator>::value and
detail::conjunction<detail::negation<detail::is_compatible_basic_json_type<
uncvref_t<T>, basic_json_t>>,
detail::has_to_json<JSONSerializer, basic_json,
uncvref_t<T>>::value,
uncvref_t<T>>>::value,
int> = 0>
basic_json(T &&val)
{
@ -3311,10 +3312,10 @@ class basic_json
template <
typename T,
enable_if_t<not detail::is_compatible_basic_json_type<
uncvref_t<T>, basic_json_t>::value and
enable_if_t<detail::conjunction<detail::negation<detail::is_compatible_basic_json_type<
uncvref_t<T>, basic_json_t>>,
detail::has_from_json<JSONSerializer, basic_json_t,
uncvref_t<T>>::value,
uncvref_t<T>>>::value,
int> = 0>
auto get() const -> uncvref_t<T>
{
@ -3331,10 +3332,10 @@ class basic_json
// This overload is chosen for non-default constructible user-defined-types
template <
typename T,
enable_if_t<not detail::is_compatible_basic_json_type<
T, basic_json_t>::value and
enable_if_t<detail::conjunction<detail::negation<detail::is_compatible_basic_json_type<
uncvref_t<T>, basic_json_t>>,
detail::has_non_default_from_json<JSONSerializer, basic_json_t,
T>::value,
uncvref_t<T>>>::value,
short> = 0>
T get() const
{