mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17: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<
|
template<
|
||||||
typename T,
|
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)
|
static inline init_type value_from(T&& x)
|
||||||
{
|
{
|
||||||
return std::forward<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>
|
template<typename T>
|
||||||
static inline auto key_from(const T& x)
|
static inline auto key_from(const T& x)
|
||||||
->decltype(type_policy::extract(x))
|
->decltype(type_policy::extract(x))
|
||||||
|
@ -239,7 +239,7 @@ namespace boost {
|
|||||||
void insert(InputIterator first, InputIterator last)
|
void insert(InputIterator first, InputIterator last)
|
||||||
{
|
{
|
||||||
for (auto pos = first; pos != last; ++pos) {
|
for (auto pos = first; pos != last; ++pos) {
|
||||||
table_.insert(value_type(*pos));
|
table_.insert(*pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user