Update SFINAE expressions to be in the return type instead of a defaulted function parameter

This commit is contained in:
LeonineKing1199
2021-11-18 12:54:17 -08:00
parent 1e553df5b6
commit 7ccd62ba98
2 changed files with 61 additions and 71 deletions

View File

@ -352,17 +352,16 @@ namespace boost {
// insert_size/initial_size // insert_size/initial_size
template <class I> template <class I>
inline std::size_t insert_size(I i, I j, inline typename boost::unordered::detail::enable_if_forward<I,
typename boost::unordered::detail::enable_if_forward<I, void*>::type = std::size_t>::type
0) insert_size(I i, I j)
{ {
return static_cast<std::size_t>(std::distance(i, j)); return static_cast<std::size_t>(std::distance(i, j));
} }
template <class I> template <class I>
inline std::size_t insert_size(I, I, inline typename boost::unordered::detail::disable_if_forward<I,
typename boost::unordered::detail::disable_if_forward<I, void*>::type = std::size_t>::type insert_size(I, I)
0)
{ {
return 1; return 1;
} }
@ -1186,41 +1185,37 @@ namespace boost {
namespace func { namespace func {
template <typename Alloc> template <typename Alloc>
inline Alloc call_select_on_container_copy_construction( inline typename boost::enable_if<
const Alloc& rhs, boost::unordered::detail::has_select_on_container_copy_construction<
typename boost::enable_if_c< Alloc>,
boost::unordered::detail::has_select_on_container_copy_construction< Alloc>::type
Alloc>::value, call_select_on_container_copy_construction(const Alloc& rhs)
void*>::type = 0)
{ {
return rhs.select_on_container_copy_construction(); return rhs.select_on_container_copy_construction();
} }
template <typename Alloc> template <typename Alloc>
inline Alloc call_select_on_container_copy_construction( inline typename boost::disable_if<
const Alloc& rhs, boost::unordered::detail::has_select_on_container_copy_construction<
typename boost::disable_if_c< Alloc>,
boost::unordered::detail::has_select_on_container_copy_construction< Alloc>::type
Alloc>::value, call_select_on_container_copy_construction(const Alloc& rhs)
void*>::type = 0)
{ {
return rhs; return rhs;
} }
template <typename SizeType, typename Alloc> template <typename SizeType, typename Alloc>
inline SizeType call_max_size(const Alloc& a, inline typename boost::enable_if<
typename boost::enable_if_c< boost::unordered::detail::has_max_size<Alloc>, SizeType>::type
boost::unordered::detail::has_max_size<Alloc>::value, void*>::type = call_max_size(const Alloc& a)
0)
{ {
return a.max_size(); return a.max_size();
} }
template <typename SizeType, typename Alloc> template <typename SizeType, typename Alloc>
inline SizeType call_max_size(const Alloc&, inline typename boost::disable_if<
typename boost::disable_if_c< boost::unordered::detail::has_max_size<Alloc>, SizeType>::type
boost::unordered::detail::has_max_size<Alloc>::value, void*>::type = call_max_size(const Alloc&)
0)
{ {
return (std::numeric_limits<SizeType>::max)(); return (std::numeric_limits<SizeType>::max)();
} }
@ -1362,41 +1357,41 @@ namespace boost {
// the only construct method that old fashioned allocators support. // the only construct method that old fashioned allocators support.
template <typename T> template <typename T>
static void construct(Alloc& a, T* p, T const& x, static typename boost::enable_if_c<
typename boost::enable_if_c< boost::unordered::detail::has_construct<Alloc, T>::value &&
boost::unordered::detail::has_construct<Alloc, T>::value && boost::is_same<T, value_type>::value,
boost::is_same<T, value_type>::value, void>::type
void*>::type = 0) construct(Alloc& a, T* p, T const& x)
{ {
a.construct(p, x); a.construct(p, x);
} }
template <typename T> template <typename T>
static void construct(Alloc&, T* p, T const& x, static typename boost::disable_if_c<
typename boost::disable_if_c< boost::unordered::detail::has_construct<Alloc, T>::value &&
boost::unordered::detail::has_construct<Alloc, T>::value && boost::is_same<T, value_type>::value,
boost::is_same<T, value_type>::value, void>::type
void*>::type = 0) construct(Alloc&, T* p, T const& x)
{ {
new (static_cast<void*>(p)) T(x); new (static_cast<void*>(p)) T(x);
} }
template <typename T> template <typename T>
static void destroy(Alloc& a, T* p, static typename boost::enable_if_c<
typename boost::enable_if_c< boost::unordered::detail::has_destroy<Alloc, T>::value &&
boost::unordered::detail::has_destroy<Alloc, T>::value && boost::is_same<T, value_type>::value,
boost::is_same<T, value_type>::value, void>::type
void*>::type = 0) destroy(Alloc& a, T* p)
{ {
a.destroy(p); a.destroy(p);
} }
template <typename T> template <typename T>
static void destroy(Alloc&, T* p, static typename boost::disable_if_c<
typename boost::disable_if_c< boost::unordered::detail::has_destroy<Alloc, T>::value &&
boost::unordered::detail::has_destroy<Alloc, T>::value && boost::is_same<T, value_type>::value,
boost::is_same<T, value_type>::value, void>::type
void*>::type = 0) destroy(Alloc&, T* p)
{ {
boost::unordered::detail::func::destroy(p); boost::unordered::detail::func::destroy(p);
} }
@ -1897,9 +1892,9 @@ namespace boost {
template <typename Alloc, typename A, typename B, typename A0, template <typename Alloc, typename A, typename B, typename A0,
typename A1, typename A2> typename A1, typename A2>
inline void construct_from_args(Alloc& alloc, std::pair<A, B>* address, inline typename enable_if<use_piecewise<A0>, void>::type
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args, construct_from_args(Alloc& alloc, std::pair<A, B>* address,
typename enable_if<use_piecewise<A0>, void*>::type = 0) boost::unordered::detail::emplace_args3<A0, A1, A2> const& args)
{ {
boost::unordered::detail::func::construct_from_tuple( boost::unordered::detail::func::construct_from_tuple(
alloc, boost::addressof(address->first), args.a1); alloc, boost::addressof(address->first), args.a1);
@ -4337,9 +4332,8 @@ namespace boost {
// if hash function throws, or inserting > 1 element, basic exception // if hash function throws, or inserting > 1 element, basic exception
// safety. Strong otherwise // safety. Strong otherwise
template <class I> template <class I>
void insert_range_equiv(I i, I j, typename boost::unordered::detail::enable_if_forward<I, void>::type
typename boost::unordered::detail::enable_if_forward<I, void*>::type = insert_range_equiv(I i, I j)
0)
{ {
if (i == j) if (i == j)
return; return;
@ -4361,9 +4355,8 @@ namespace boost {
} }
template <class I> template <class I>
void insert_range_equiv(I i, I j, typename boost::unordered::detail::disable_if_forward<I, void>::type
typename boost::unordered::detail::disable_if_forward<I, insert_range_equiv(I i, I j)
void*>::type = 0)
{ {
for (; i != j; ++i) { for (; i != j; ++i) {
emplace_equiv(boost::unordered::detail::func::construct_node( emplace_equiv(boost::unordered::detail::func::construct_node(

View File

@ -385,10 +385,9 @@ namespace boost {
} }
template <class P2> template <class P2>
std::pair<iterator, bool> insert(BOOST_RV_REF(P2) obj, typename boost::enable_if<
typename boost::enable_if_c< boost::is_constructible<value_type, BOOST_RV_REF(P2)>,
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value, std::pair<iterator, bool> >::type insert(BOOST_RV_REF(P2) obj)
void*>::type = 0)
{ {
return this->emplace(boost::forward<P2>(obj)); return this->emplace(boost::forward<P2>(obj));
} }
@ -404,10 +403,9 @@ namespace boost {
} }
template <class P2> template <class P2>
iterator insert(const_iterator hint, BOOST_RV_REF(P2) obj, typename boost::enable_if<
typename boost::enable_if_c< boost::is_constructible<value_type, BOOST_RV_REF(P2)>, iterator>::type
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value, insert(const_iterator hint, BOOST_RV_REF(P2) obj)
void*>::type = 0)
{ {
return this->emplace_hint(hint, boost::forward<P2>(obj)); return this->emplace_hint(hint, boost::forward<P2>(obj));
} }
@ -1249,10 +1247,9 @@ namespace boost {
} }
template <class P2> template <class P2>
iterator insert(BOOST_RV_REF(P2) obj, typename boost::enable_if<
typename boost::enable_if_c< boost::is_constructible<value_type, BOOST_RV_REF(P2)>,
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value, iterator>::type insert(BOOST_RV_REF(P2) obj)
void*>::type = 0)
{ {
return this->emplace(boost::forward<P2>(obj)); return this->emplace(boost::forward<P2>(obj));
} }
@ -1268,10 +1265,10 @@ namespace boost {
} }
template <class P2> template <class P2>
iterator insert(const_iterator hint, BOOST_RV_REF(P2) obj, typename boost::enable_if<
typename boost::enable_if_c< boost::is_constructible<value_type, BOOST_RV_REF(P2)>,
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value, iterator>::type
void*>::type = 0) insert(const_iterator hint, BOOST_RV_REF(P2) obj)
{ {
return this->emplace_hint(hint, boost::forward<P2>(obj)); return this->emplace_hint(hint, boost::forward<P2>(obj));
} }