use typename U = uncvref_t where appropriate

This commit is contained in:
Théo DELRIEU 2017-01-21 17:20:32 +01:00
parent 37fd20b2eb
commit ba0b35f414
2 changed files with 18 additions and 18 deletions

View file

@ -3107,9 +3107,8 @@ class basic_json
// do we really want the uncvref ? if a user call get<int &>, shouldn't we // do we really want the uncvref ? if a user call get<int &>, shouldn't we
// static assert ? // static assert ?
// i know there is a special behaviour for boolean_t* and such // i know there is a special behaviour for boolean_t* and such
auto get() const noexcept(noexcept(JSONSerializer<U>::from_json( U get() const noexcept(noexcept(JSONSerializer<U>::from_json(
std::declval<const basic_json_t&>(), std::declval<U&>()))) std::declval<const basic_json_t&>(), std::declval<U&>())))
-> U
{ {
static_assert(std::is_default_constructible<U>::value and static_assert(std::is_default_constructible<U>::value and
std::is_copy_constructible<U>::value, std::is_copy_constructible<U>::value,
@ -3137,11 +3136,12 @@ class basic_json
*/ */
template < template <
typename T, typename T,
detail::enable_if_t<not std::is_same<basic_json_t, detail::uncvref_t<T>>::value and typename U = detail::uncvref_t<T>,
detail::enable_if_t<not std::is_same<basic_json_t, U>::value and
detail::has_non_default_from_json<basic_json_t, detail::has_non_default_from_json<basic_json_t,
detail::uncvref_t<T>>::value, U>::value,
int> = 0 > int> = 0 >
detail::uncvref_t<T> get() const noexcept(noexcept(JSONSerializer<T>::from_json(std::declval<const basic_json_t&>()))) U get() const noexcept(noexcept(JSONSerializer<T>::from_json(std::declval<const basic_json_t&>())))
{ {
return JSONSerializer<T>::from_json(*this); return JSONSerializer<T>::from_json(*this);
} }

View file

@ -3107,9 +3107,8 @@ class basic_json
// do we really want the uncvref ? if a user call get<int &>, shouldn't we // do we really want the uncvref ? if a user call get<int &>, shouldn't we
// static assert ? // static assert ?
// i know there is a special behaviour for boolean_t* and such // i know there is a special behaviour for boolean_t* and such
auto get() const noexcept(noexcept(JSONSerializer<U>::from_json( U get() const noexcept(noexcept(JSONSerializer<U>::from_json(
std::declval<const basic_json_t&>(), std::declval<U&>()))) std::declval<const basic_json_t&>(), std::declval<U&>())))
-> U
{ {
static_assert(std::is_default_constructible<U>::value and static_assert(std::is_default_constructible<U>::value and
std::is_copy_constructible<U>::value, std::is_copy_constructible<U>::value,
@ -3137,11 +3136,12 @@ class basic_json
*/ */
template < template <
typename T, typename T,
detail::enable_if_t<not std::is_same<basic_json_t, detail::uncvref_t<T>>::value and typename U = detail::uncvref_t<T>,
detail::enable_if_t<not std::is_same<basic_json_t, U>::value and
detail::has_non_default_from_json<basic_json_t, detail::has_non_default_from_json<basic_json_t,
detail::uncvref_t<T>>::value, U>::value,
int> = 0 > int> = 0 >
detail::uncvref_t<T> get() const noexcept(noexcept(JSONSerializer<T>::from_json(std::declval<const basic_json_t&>()))) U get() const noexcept(noexcept(JSONSerializer<T>::from_json(std::declval<const basic_json_t&>())))
{ {
return JSONSerializer<T>::from_json(*this); return JSONSerializer<T>::from_json(*this);
} }