Created on 2010-08-25.00:00:00 last changed 161 months ago
Proposed resolution:
Edit [utility] p. 2, header <utility> synopsis and [utility.swap] before p. 1, as indicated (The intent is to fix an editorial omission):
template<class T> void swap(T& a, T& b) noexcept(see below);
Edit the prototype declaration in [pairs.pair] before p. 34 as indicated (The intent is to fix an editorial omission):
void swap(pair& p) noexcept(see below);
Edit [tuple.general] p. 2 header <tuple> synopsis and [tuple.special] before p. 1 as indicated (The intent is to fix an editorial omission):
template <class... Types> void swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(see below);
Edit [tuple.tuple], class template tuple synopsis and [tuple.swap] before p. 1 as indicated (The intent is to fix an editorial omission):
void swap(tuple&) noexcept(see below);
Edit [memory.syn] p. 1, header <memory> synopsis as indicated (The intent is to fix an editorial omission of the proposing paper N3195).
template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
Edit header <valarray> synopsis, [valarray.syn] and [valarray.special] before p. 1 as indicated [Drafting comment: The corresponding member swap is already noexcept]:
template<class T> void swap(valarray<T>&, valarray<T>&) noexcept;
[ 2011-03-22 Daniel redrafts to satisfy new criteria for applying noexcept. Parts resolved by N3263-v2 and D3267 are not added here. ]
[ 2011-03-13: Daniel comments and drafts wording ]
During a survey of the library some main categories for potential noexcept swap function could be isolated:
Negative list:
While evaluating the current state of swap functions of library components it was observed that several conditional noexcept functions have turned into unconditional ones, e.g. in the header <utility> synopsis:
template<class T> void swap(T& a, T& b) noexcept;
The suggested resolution shown below also attempts to fix these cases.
[ Resolution proposed by ballot comment ]
Where possible, all library types should provide a swap operation with an exception specification guaranteeing no exception shall propagate. Where noexcept(true) cannot be guaranteed to not terminate the program, and the swap in questions is a template, an exception specification with the appropriate conditional expression could be specified.
Addresses GB-65
Nothrowing swap operations are key to many C++ idioms, notably the common copy/swap idiom to provide the strong exception safety guarantee.
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2011-04-11 11:23:23 | admin | set | status: immediate -> wp |
2011-03-23 18:19:51 | admin | set | status: open -> immediate |
2011-03-22 23:36:56 | admin | set | messages: + msg5662 |
2011-03-13 18:26:09 | admin | set | messages: + msg5648 |
2011-03-13 18:26:09 | admin | set | messages: + msg5647 |
2010-10-24 22:33:31 | admin | set | messages: + msg5056 |
2010-10-24 10:50:39 | admin | set | messages: + msg4978 |
2010-08-25 00:00:00 | admin | create |