Title
Header for iter_swap
Status
nad
Section
[iterator.synopsis]
Submitter
Alisdair Meredith

Created on 2010-02-16.00:00:00 last changed 83 months ago

Messages

Date: 2017-06-05.15:41:21

Proposed resolution:

Add the declaration of iter_swap to the <iterator> header synopsis ([iterator.synopsis]), with a note that it is documented in clause [algorithms].

...
template <class T, size_t N> T* end(T (&array)[N]);

// documented in [algorithms]
template<class ForwardIterator1, class ForwardIterator2>
  void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
Date: 2017-06-02.00:00:00

[ 2017-06-02 Issues Telecon ]

Resolve as NAD

Date: 2017-06-05.15:41:21

[ 2017-02 in Kona, LEWG recommends NAD ]

Date: 2010-11-13.23:03:59

[ ]

Discussed possibly moving to <utility> but don't like that. Some not seeing this as a defect, and want to keep it in <algorithm>. No one seems to feel strongly about moving to <iterator>.

Date: 2010-02-16.00:00:00

The iter_swap function template appears in the <algorithm> header, yet its main use is in building further algorithms, not calling existing ones. The main clients are implementers of data structures and their iterators, so it seems most appropriate to place the template in the <iterator> header instead.

Note that this is not an issue for implementers of the standard library, as they rarely use the standard headers directly, designing a more fine-grained set of headers for their own internal use. This option is not available to customers of the standard library.

Note that we cannot remove iter_swap from <algorithm> without breaking code, but there is no reason we cannot offer the same declaration via two standard headers. Alternatively, require <algorithm> to #include <iterator>, but introducing the dependency on the iterator adaptors seems un-necessary.

History
Date User Action Args
2017-06-05 15:41:21adminsetmessages: + msg9213
2017-06-05 15:41:21adminsetmessages: + msg9212
2017-06-05 15:41:21adminsetstatus: lewg -> nad
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2010-11-13 23:03:59adminsetmessages: + msg5359
2010-11-13 23:03:59adminsetstatus: new -> nad future
2010-10-21 18:28:33adminsetmessages: + msg1589
2010-02-16 00:00:00admincreate