mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Remove unnecessary value_type conversion by expanding overloads for value_from()
This commit is contained in:
@ -1499,13 +1499,30 @@ private:
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<!is_init_or_value_type<T>::value>::type* =nullptr
|
||||
typename Ty=typename std::decay<T>::type,
|
||||
typename std::enable_if<
|
||||
!is_init_or_value_type<T>::value&&
|
||||
std::is_convertible<Ty,init_type>::value
|
||||
>::type* =nullptr
|
||||
>
|
||||
static inline init_type value_from(T&& x)
|
||||
{
|
||||
return std::forward<T>(x);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename Ty=typename std::decay<T>::type,
|
||||
typename std::enable_if<
|
||||
!is_init_or_value_type<T>::value&&
|
||||
!std::is_convertible<Ty,init_type>::value
|
||||
>::type* =nullptr
|
||||
>
|
||||
static inline value_type value_from(T&& x)
|
||||
{
|
||||
return std::forward<T>(x);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline auto key_from(const T& x)
|
||||
->decltype(type_policy::extract(x))
|
||||
|
@ -239,7 +239,7 @@ namespace boost {
|
||||
void insert(InputIterator first, InputIterator last)
|
||||
{
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(value_type(*pos));
|
||||
table_.insert(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user