diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-05-06 13:44:36 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-10-01 20:34:48 +0100 |
commit | fb4d55ef61ca3191ec946d4d41e0e715f4cc4197 (patch) | |
tree | bb8483706c5a4ceb0663a4c79dc4e087c253dfd6 /gcc | |
parent | 10b6d89baddd86139480ba902f491903fcb464a6 (diff) | |
download | gcc-fb4d55ef61ca3191ec946d4d41e0e715f4cc4197.zip gcc-fb4d55ef61ca3191ec946d4d41e0e715f4cc4197.tar.gz gcc-fb4d55ef61ca3191ec946d4d41e0e715f4cc4197.tar.bz2 |
libstdc++: Simplify __normal_iterator converting constructor
This uses C++11 features to simplify the definition of the
__normal_iterator constructor that allows converting from iterator to
const_iterator. The previous definition relied on _Container::pointer
which is present in std::vector and std::basic_string, but is not
actually part of the container requirements.
Removing the use of _Container::pointer and defining it in terms of
is_convertible allows __normal_iterator to be used with new container
types which do not define a pointer member. Specifically, this will
allow it to be used in std::basic_stacktrace.
In theory this will enable some conversions which were not previously
permitted, for example __normal_iterator<volatile T*, vector<T>> can
now be converted to __normal_iterator<const volatile T*, vector<T>>.
In practice this doesn't matter because the library never uses such
types. In any case, allowing those conversions is consistent with
the corresponding constructors of std::reverse_iterator and
std::move_iterator.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator.h (__normal_iterator): Simplify
converting constructor and do not require _Container::pointer.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions