mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
refactored insert overloads
This commit is contained in:
@ -1084,43 +1084,6 @@ private:
|
|||||||
static constexpr bool has_mutable_iterator=
|
static constexpr bool has_mutable_iterator=
|
||||||
!std::is_same<key_type,value_type>::value;
|
!std::is_same<key_type,value_type>::value;
|
||||||
|
|
||||||
template<
|
|
||||||
typename T,
|
|
||||||
typename RawT=typename std::remove_cv<
|
|
||||||
typename std::remove_reference<T>::type>::type
|
|
||||||
>
|
|
||||||
using value_from_return_type=typename std::conditional<
|
|
||||||
std::is_same<RawT,init_type>::value||std::is_same<RawT,value_type>::value,
|
|
||||||
T,
|
|
||||||
typename std::conditional<
|
|
||||||
std::is_convertible<T,init_type&&>::value,
|
|
||||||
init_type,
|
|
||||||
typename std::conditional<
|
|
||||||
std::is_convertible<T,value_type&&>::value,
|
|
||||||
value_type,
|
|
||||||
typename std::conditional<
|
|
||||||
std::is_convertible<T,const init_type&>::value,
|
|
||||||
const init_type&,
|
|
||||||
typename std::conditional<
|
|
||||||
std::is_convertible<T,const value_type&>::value,
|
|
||||||
const value_type&,
|
|
||||||
void
|
|
||||||
>::type
|
|
||||||
>::type
|
|
||||||
>::type
|
|
||||||
>::type
|
|
||||||
>::type;
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename T,
|
|
||||||
typename std::enable_if<
|
|
||||||
!std::is_void<value_from_return_type<T&&>>::value>::type* =nullptr
|
|
||||||
>
|
|
||||||
static inline value_from_return_type<T&&> value_from(T&& x)
|
|
||||||
{
|
|
||||||
return std::forward<T>(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using hasher=Hash;
|
using hasher=Hash;
|
||||||
using key_equal=Pred;
|
using key_equal=Pred;
|
||||||
@ -1306,17 +1269,21 @@ public:
|
|||||||
std::forward_as_tuple(std::forward<Args>(args)...));
|
std::forward_as_tuple(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
BOOST_FORCEINLINE std::pair<iterator,bool>
|
||||||
BOOST_FORCEINLINE auto insert(T&& x)
|
insert(const init_type& x){return emplace_impl(x);}
|
||||||
->decltype(value_from(std::forward<T>(x)),std::pair<iterator,bool>())
|
|
||||||
{
|
|
||||||
return emplace_impl(value_from(std::forward<T>(x)));
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_FORCEINLINE std::pair<iterator,bool> insert(init_type&& x)
|
BOOST_FORCEINLINE std::pair<iterator,bool>
|
||||||
{
|
insert(init_type&& x){return emplace_impl(std::move(x));}
|
||||||
return emplace_impl(std::move(x));
|
|
||||||
}
|
/* template<typename=void> tilts call ambiguities in favor of init_type */
|
||||||
|
|
||||||
|
template<typename=void>
|
||||||
|
BOOST_FORCEINLINE std::pair<iterator,bool>
|
||||||
|
insert(const value_type& x){return emplace_impl(x);}
|
||||||
|
|
||||||
|
template<typename=void>
|
||||||
|
BOOST_FORCEINLINE std::pair<iterator,bool>
|
||||||
|
insert(value_type&& x){return emplace_impl(std::move(x));}
|
||||||
|
|
||||||
template<
|
template<
|
||||||
bool dependent_value=false,
|
bool dependent_value=false,
|
||||||
|
Reference in New Issue
Block a user