Created on 2002-05-13.00:00:00 last changed 172 months ago
Rationale:
The assumption is that an input iterator can't be dereferenced twice. There's no basis for that assumption in the Standard.
Proposed resolution:
Add "If InputIterator does not meet the requirements of forward iterator, then the value type of InputIterator must be copy constructible. Otherwise copy constructible is not required." to [alg.remove] paragraph 6.
remove_copy and remove_copy_if ([alg.remove]) permit their input range to be marked with Input Iterators. However, since two operations are required against the elements to copy (comparison and assigment), when the input range uses Input Iterators, a temporary copy must be taken to avoid dereferencing the iterator twice. This therefore requires the value type of the InputIterator to be CopyConstructible. If the iterators are at least Forward Iterators, then the iterator can be dereferenced twice, or a reference to the result maintained, so the temporary is not required.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2375 |
2010-10-21 18:28:33 | admin | set | messages: + msg2374 |
2002-05-13 00:00:00 | admin | create |