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

View File

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