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.
swap
's with rvalue-referencesSection: 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:
Change 22.3 [pairs]/1 as indicated:
template <class T1, class T2> struct pair { ... void swap(pair&&p); };
Change 22.3 [pairs] before p. 17 as indicated:
void swap(pair&&p);
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);
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);
Change 22.4.4 [tuple.tuple] as indicated:
// 20.5.2.3, tuple swap void swap(tuple&&)
Change 22.4.4.4 [tuple.swap] before 1 as indicated:
void swap(tuple&&rhs);
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...)&&);
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...)>&&);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
Change 24.3.12.3 [vector.capacity] before p. 8 as indicated:
void swap(vector<T,Allocator>&&x);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);