This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.

1232. Still swap's with rvalue-references

Section: 16 [library] Status: NAD Editorial Submitter: Daniel Krügler Opened: 2009-10-11 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [library].

View all other issues in [library].

View all issues with NAD Editorial status.

Discussion:

The current library contains still rvalue reference-swaps that seem to be overlooked in the process of switching back to lvalue-ref swaps.

[ 2009-10 Santa Cruz: ]

Editor accepts as NAD Editorial.

Proposed resolution:

  1. Change 22.3 [pairs]/1 as indicated:

    template <class T1, class T2>
    struct pair {
      ...
      void swap(pair&& p);
    };
    
  2. Change 22.3 [pairs] before p. 17 as indicated:

    void swap(pair&& p);
    
  3. Change 22.3 [pairs] before p. 21 as indicated:

    template<class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y);
    template<class T1, class T2> void swap(pair<T1, T2>&& x, pair<T1, T2>& y);
    template<class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>&& y);
    
  4. Change 22.4.1 [tuple.general]/2, header <tuple> synopsis, as indicated:

    // 20.5.2.9, specialized algorithms:
    template <class... Types>
    void swap(tuple<Types...>& x, tuple<Types...>& y);
    template <class... Types>
    void swap(tuple<Types...>&& x, tuple<Types...>& y);
    template <class... Types>
    void swap(tuple<Types...>& x, tuple<Types...>&& y);
    
  5. Change 22.4.4 [tuple.tuple] as indicated:

    // 20.5.2.3, tuple swap
    void swap(tuple&&)
    
  6. Change 22.4.4.4 [tuple.swap] before 1 as indicated:

    void swap(tuple&& rhs);
    
  7. Change 22.10 [function.objects]/2, header <functional> synopsis, as indicated:

    template<class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
    template<class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&&, function<R(ArgTypes...)>&);
    template<class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)&&);
    
  8. Change 22.10.17.3 [func.wrap.func], as indicated:

    // 20.7.15.2.2, function modifiers:
    void swap(function&&);
    template<class F, class A> void assign(F, const A&);
    
    [..]
    
    // 20.7.15.2.7, specialized algorithms:
    template <class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
    template <class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&&, function<R(ArgTypes...)>&);
    template <class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&&);
    
  9. Change 22.10.17.3.8 [func.wrap.func.alg] before 1 as indicated:

    template<class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>& f1, function<R(ArgTypes...)>& f2);
    template<class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>&& f1, function<R(ArgTypes...)>& f2);
    template<class R, class... ArgTypes>
    void swap(function<R(ArgTypes...)>& f1, function<R(ArgTypes...)>&& f2);
    
  10. Change 20.3.2.2 [util.smartptr.shared]/1 as indicated:

    // 20.8.12.2.4, modifiers:
    void swap(shared_ptr&& r);
    
    [..]
    
    // 20.8.12.2.9, shared_ptr specialized algorithms:
    template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b);
    template<class T> void swap(shared_ptr<T>&& a, shared_ptr<T>& b);
    template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>&& b);
    
  11. Change 23.4 [string.classes]/1, header <string> synopsis, as indicated:

    // 21.4.8.8: swap
    template<class charT, class traits, class Allocator>
    void swap(basic_string<charT,traits,Allocator>& lhs, basic_string<charT,traits,Allocator>& rhs);
    template<class charT, class traits, class Allocator>
    void swap(basic_string<charT,traits,Allocator>&& lhs, basic_string<charT,traits,Allocator>& rhs);
    template<class charT, class traits, class Allocator>
    void swap(basic_string<charT,traits,Allocator>& lhs, basic_string<charT,traits,Allocator>&& rhs);
    
  12. Change 24.3 [sequences]/1, header <deque> synopsis, as indicated:

    template <class T, class Allocator>
    void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(deque<T,Allocator>&& x, deque<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(deque<T,Allocator>& x, deque<T,Allocator>&& y);
    
  13. Change 24.3 [sequences]/1, header <list> synopsis, as indicated:

    template <class T, class Allocator>
    void swap(list<T,Allocator>& x, list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(list<T,Allocator>&& x, list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(list<T,Allocator>& x, list<T,Allocator>&& y);
    
  14. Change 24.3 [sequences]/1, header <queue> synopsis, as indicated:

    template <class T, class Allocator>
    void swap(queue<T, Container>& x, queue<T, Container>& y);
    template <class T, class Container>
    void swap(queue<T, Container>&& x, queue<T, Container>& y);
    template <class T, class Container>
    void swap(queue<T, Container>& x, queue<T, Container>&& y);
    
    template <class T, class Container = vector<T>, class Compare = less<typename Container::value_type> >
    class priority_queue;
    template <class T, class Container, class Compare>
    void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>& y);
    template <class T, class Container, class Compare>
    void swap(priority_queue<T, Container, Compare>&& x, priority_queue<T, Container, Compare>& y);
    template <class T, class Container, class Compare>
    void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>&& y);
    
  15. Change 24.3 [sequences]/1, header <stack> synopsis, as indicated:

    template <class T, class Container>
    void swap(stack<T, Container>& x, stack<T, Container>& y);
    template <class T, class Container>
    void swap(stack<T, Container>&& x, stack<T, Container>& y);
    template <class T, class Container>
    void swap(stack<T, Container>& x, stack<T, Container>&& y);
    
  16. Change 24.3 [sequences]/1, header <vector> synopsis, as indicated:

    template <class T, class Allocator>
    void swap(vector<T,Allocator>& x, vector<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(vector<T,Allocator>&& x, vector<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(vector<T,Allocator>& x, vector<T,Allocator>&& y);
    
  17. Change 24.3.9 [deque]/2 as indicated:

    iterator erase(const_iterator position);
    iterator erase(const_iterator first, const_iterator last);
    void swap(deque<T,Allocator>&&);
    void clear();
    
    [..]
    
    // specialized algorithms:
    template <class T, class Allocator>
    void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(deque<T,Allocator>&& x, deque<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(deque<T,Allocator>& x, deque<T,Allocator>&& y);
    
  18. Change [deque.special] as indicated:

    template <class T, class Allocator>
    void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(deque<T,Allocator>&& x, deque<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(deque<T,Allocator>& x, deque<T,Allocator>&& y);
    
  19. Change [forwardlist]/2 as indicated:

    iterator erase_after(const_iterator position);
    iterator erase_after(const_iterator position, iterator last);
    void swap(forward_list<T,Allocator>&&);
    
    [..]
    
    // 23.3.3.6 specialized algorithms:
    template <class T, class Allocator>
    void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(forward_list<T,Allocator>&& x, forward_list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>&& y);
    
  20. Change [forwardlist.spec] as indicated:

    template <class T, class Allocator>
    void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(forward_list<T,Allocator>&& x, forward_list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>&& y);
    
  21. Change 24.3.11 [list]/2 as indicated:

    iterator erase(const_iterator position);
    iterator erase(const_iterator position, const_iterator last);
    void swap(list<T,Allocator>&&);
    void clear();
    
    [..]
    
    // specialized algorithms:
    template <class T, class Allocator>
    void swap(list<T,Allocator>& x, list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(list<T,Allocator>&& x, list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(list<T,Allocator>& x, list<T,Allocator>&& y);
    
  22. Change [list.special] as indicated:

    template <class T, class Allocator>
    void swap(list<T,Allocator>& x, list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(list<T,Allocator>&& x, list<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(list<T,Allocator>& x, list<T,Allocator>&& y);
    
  23. Change 24.6.6.1 [queue.defn] as indicated:

    void swap(queue&& q) { c.swap(q.c); }
    
    [..]
    
    template <class T, class Container>
    void swap(queue<T, Container>& x, queue<T, Container>& y);
    template <class T, class Container>
    void swap(queue<T, Container>&& x, queue<T, Container>& y);
    template <class T, class Container>
    void swap(queue<T, Container>& x, queue<T, Container>&& y);
    
  24. Change 24.6.6.6 [queue.special] as indicated:

    template <class T, class Container>
    void swap(queue<T, Container>& x, queue<T, Container>& y);
    template <class T, class Container>
    void swap(queue<T, Container>&& x, queue<T, Container>& y);
    template <class T, class Container>
    void swap(queue<T, Container>& x, queue<T, Container>&& y);
    
  25. Change 24.6.7 [priority.queue]/1 as indicated:

    void swap(priority_queue&&);
    
    // no equality is provided
    template <class T, class Container, class Compare>
    void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>& y);
    template <class T, class Container, class Compare>
    void swap(priority_queue<T, Container, Compare>&& x, priority_queue<T, Container, Compare>& y);
    template <class T, class Container, class Compare>
    void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>&& y);
    
  26. Change 24.6.7.5 [priqueue.special] as indicated:

    template <class T, class Container, Compare>
    void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>& y);
    template <class T, class Container, Compare>
    void swap(priority_queue<T, Container, Compare>&& x, priority_queue<T, Container, Compare>& y);
    template <class T, class Container, Compare>
    void swap(priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>&& y);
    
  27. Change 24.6.8.2 [stack.defn] as indicated:

    void swap(stack&& s) { c.swap(s.c); }
    
    [..]
    
    template <class T, class Allocator>
    void swap(stack<T,Allocator>& x, stack<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(stack<T,Allocator>&& x, stack<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(stack<T,Allocator>& x, stack<T,Allocator>&& y);
    
  28. Change 24.6.8.7 [stack.special] as indicated:

    template <class T, class Container>
    void swap(stack<T, Container>& x, stack<T, Container>& y);
    template <class T, class Container>
    void swap(stack<T, Container>&& x, stack<T, Container>& y);
    template <class T, class Container>
    void swap(stack<T, Container>& x, stack<T, Container>&& y);
    
  29. Change 24.3.12 [vector]/2 as indicated:

    void swap(vector<T,Allocator>&&);
    void clear();
    
    [..]
    
    // specialized algorithms:
    template <class T, class Allocator>
    void swap(vector<T,Allocator>& x, vector<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(vector<T,Allocator>&& x, vector<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(vector<T,Allocator>& x, vector<T,Allocator>&& y);
    
  30. Change 24.3.12.3 [vector.capacity] before p. 8 as indicated:

    void swap(vector<T,Allocator>&& x);
    
  31. Change [vector.special] as indicated:

    template <class T, class Allocator>
    void swap(vector<T,Allocator>& x, vector<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(vector<T,Allocator>&& x, vector<T,Allocator>& y);
    template <class T, class Allocator>
    void swap(vector<T,Allocator>& x, vector<T,Allocator>&& y);
    
  32. Change 24.3.13 [vector.bool]/1 as indicated:

    iterator erase(const_iterator first, const_iterator last);
    void swap(vector<bool,Allocator>&&);
    static void swap(reference x, reference y);
    
  33. Change 24.4 [associative]/1, header <map> synopsis as indicated:

    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator>& x, map<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator&& x, map<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator& x, map<Key,T,Compare,Allocator>&& y);
    
    [..]
    
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator>& x, multimap<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator&& x, multimap<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator& x, multimap<Key,T,Compare,Allocator>&& y);
    
  34. Change 24.4 [associative]/1, header <set> synopsis as indicated:

    template <class Key, class Compare, class Allocator>
    void swap(set<Key,Compare,Allocator>& x, set<Key,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(set<Key,T,Compare,Allocator&& x, set<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(set<Key,T,Compare,Allocator& x, set<Key,T,Compare,Allocator>&& y);
    
    [..]
    
    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator>& x, multiset<Key,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multiset<Key,T,Compare,Allocator&& x, multiset<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multiset<Key,T,Compare,Allocator& x, multiset<Key,T,Compare,Allocator>&& y);
    
  35. Change 24.4.4 [map]/2 as indicated:

    iterator erase(const_iterator first, const_iterator last);
    void swap(map<Key,T,Compare,Allocator>&&);
    void clear();
    
    [..]
    
    // specialized algorithms:
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator>& x, map<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator&& x, map<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator& x, map<Key,T,Compare,Allocator>&& y);
    
  36. Change [map.special] as indicated:

    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator>& x, map<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator>&& x, map<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(map<Key,T,Compare,Allocator>& x, map<Key,T,Compare,Allocator>&& y);
    
  37. Change 24.4.5 [multimap]/2 as indicated:

    iterator erase(const_iterator first, const_iterator last);
    void swap(multimap<Key,T,Compare,Allocator>&&);
    void clear();
    
    [..]
    
    // specialized algorithms:
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator>& x, multimap<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator&& x, multimap<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator& x, multimap<Key,T,Compare,Allocator>&& y);
    
  38. Change [multimap.special] as indicated:

    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator>& x, multimap<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator>&& x, multimap<Key,T,Compare,Allocator>& y);
    template <class Key, class T, class Compare, class Allocator>
    void swap(multimap<Key,T,Compare,Allocator>& x, multimap<Key,T,Compare,Allocator>&& y);
    
  39. Change 24.4.6 [set]/2 and [set.special] as indicated: (twice!)

    // specialized algorithms:
    template <class Key, class Compare, class Allocator>
    void swap(set<Key,Compare,Allocator>& x, set<Key,Compare,Allocator>& y);
    template <class Key, class Compare, class Allocator>
    void swap(set<Key,Compare,Allocator&& x, set<Key,Compare,Allocator>& y);
    template <class Key, class Compare, class Allocator>
    void swap(set<Key,Compare,Allocator& x, set<Key,Compare,Allocator>&& y);
    
  40. Change 24.4.7 [multiset]/2 as indicated:

    iterator erase(const_iterator first, const_iterator last);
    void swap(multiset<Key,Compare,Allocator>&&);
    void clear();
    
    [..]
    
    // specialized algorithms:
    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator>& x, multiset<Key,Compare,Allocator>& y);
    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator&& x, multiset<Key,Compare,Allocator>& y);
    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator& x, multiset<Key,Compare,Allocator>&& y);
    
  41. Change [multiset.special] as indicated:

    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator>& x, multiset<Key,Compare,Allocator>& y);
    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator>&& x, multiset<Key,Compare,Allocator>& y);
    template <class Key, class Compare, class Allocator>
    void swap(multiset<Key,Compare,Allocator>& x, multiset<Key,Compare,Allocator>&& y);