On 22/11/18 19:10 +0100, Marc Glisse wrote:
On Thu, 22 Nov 2018, Jonathan Wakely wrote:

On 26/10/18 14:02 +0200, Marc Glisse wrote:
Index: libstdc++-v3/include/bits/stl_iterator.h
===================================================================
--- libstdc++-v3/include/bits/stl_iterator.h    (revision 265522)
+++ libstdc++-v3/include/bits/stl_iterator.h    (working copy)
@@ -59,20 +59,24 @@

#ifndef _STL_ITERATOR_H
#define _STL_ITERATOR_H 1

#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
#include <bits/move.h>
#include <bits/ptr_traits.h>

#if __cplusplus > 201402L

I think this should be >= 201103L, no?

Ah, yes, I guess I started from a copy-paste and got interrupted before updating it :-(

OK for trunk (with that #if changed, if appropriate).

Thanks. Re-tested and committed. Do you have an opinion on the following item, which may be a bug in the current code?

"For __relocate_a_1, I should also test if copying, ++ and != are noexcept, but I wanted to ask first because there might be restrictions on what iterators are allowed to do, even if I didn't see them."

I decided to postpone thinking about that :-)

In general iterators can throw on those operations. But for container
iterators copy construction of "a returned iterator" never throws. I
think that means that copying a singular iterator is allowed to throw,
but no container member functions ever return singular iterators.

Increment and decrement could throw, but for our implementation they
don't (and so far __relocate_a_1 is only used with pointers, or vector
or deque iterators, right?) Since we know we're using valid iterator
ranges (because we choose the begin and end iterators of the ranges
being relocated) it should also be safe to assume we never increment a
past-the-end iterator or anything else that might give an iterator a
reasom to throw.

Is that good enough, or do you want to make __relocate_a_1 general
enough to work with arbitrary iterators?

Reply via email to