Remove moved_value_from() in favor of overloading move() in container type traits

This commit is contained in:
Christian Mazakas
2023-01-12 10:52:03 -08:00
parent 91b3863c77
commit b57b51b036
5 changed files with 10 additions and 25 deletions

View File

@ -1255,7 +1255,7 @@ public:
* elements' values.
*/
x.for_all_elements([this](element_type* p){
unchecked_insert(type_policy::moved_value_from(*p));
unchecked_insert(type_policy::move(type_policy::value_from(*p)));
});
}
}
@ -1352,7 +1352,7 @@ public:
* elements' values.
*/
x.for_all_elements([this](element_type* p){
unchecked_insert(type_policy::moved_value_from(*p));
unchecked_insert(type_policy::move(type_policy::value_from(*p)));
});
}
}

View File

@ -60,11 +60,6 @@ namespace boost {
std::move(const_cast<raw_mapped_type&>(x.second))};
}
static moved_type moved_value_from(element_type& x)
{
return move(x);
}
template <class A>
static void construct(A& al, element_type* p, moved_type&& x)
{

View File

@ -41,15 +41,10 @@ namespace boost {
using element_type = value_type;
static Key const& value_from(element_type const& x) { return x; }
static Key& value_from(element_type& x) { return x; }
static element_type&& move(element_type& x) { return std::move(x); }
static element_type&& moved_value_from(element_type& x)
{
return move(x);
}
template <class A>
static void construct(A& al, element_type* p, element_type const& copy)
{

View File

@ -41,6 +41,7 @@ namespace boost {
using init_type = std::pair<raw_key_type, raw_mapped_type>;
using value_type = std::pair<Key const, T>;
using moved_type = std::pair<raw_key_type&&, raw_mapped_type&&>;
struct element_type
{
@ -57,13 +58,6 @@ namespace boost {
static value_type& value_from(element_type x) { return *(x.p); }
static std::pair<raw_key_type&&, raw_mapped_type&&> moved_value_from(
element_type& x)
{
return {std::move(const_cast<raw_key_type&>(x.p->first)),
std::move(const_cast<raw_mapped_type&>(x.p->second))};
}
template <class K, class V>
static raw_key_type const& extract(std::pair<K, V> const& kv)
{
@ -76,6 +70,11 @@ namespace boost {
}
static element_type&& move(element_type& x) { return std::move(x); }
static moved_type move(value_type& x)
{
return {std::move(const_cast<raw_key_type&>(x.first)),
std::move(const_cast<raw_mapped_type&>(x.second))};
}
template <class A>
static void construct(A&, element_type* p, element_type&& x)

View File

@ -56,11 +56,7 @@ namespace boost {
static value_type& value_from(element_type x) { return *x.p; }
static Key const& extract(element_type k) { return *k.p; }
static element_type&& move(element_type& x) { return std::move(x); }
static value_type&& moved_value_from(element_type& x)
{
return std::move(*x.p);
}
static value_type&& move(value_type& x) { return std::move(x); }
template <class A>
static void construct(A& al, element_type* p, element_type const& copy)