diff options
author | Jason Merrill <jason@redhat.com> | 2021-03-02 16:30:41 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-05-01 05:45:06 -0400 |
commit | 3307b9a07a3c515c6805d435e4bedada77687183 (patch) | |
tree | b78aa228c7c0c568b647be2091a969c86cd736df /contrib | |
parent | 3c65858787dc52b65b26fa7018587c01510f442c (diff) | |
download | gcc-3307b9a07a3c515c6805d435e4bedada77687183.zip gcc-3307b9a07a3c515c6805d435e4bedada77687183.tar.gz gcc-3307b9a07a3c515c6805d435e4bedada77687183.tar.bz2 |
c++: C++11 range-for and ovl/lkp_iterator
We can't use C++11 range-based 'for' over a tree directly, because we don't
know what kind of range we want to use it as. I suppose in some cases we
could guess, but it seems better to tersely make it explicit. This patch
adds range adaptors ovl_range and lkp_range for use as the range of a
range-for, e.g.
for (tree fn : lkp_range (fns)) { ... }
This patch also removes the private copy ops from ovl_iterator; it's
necessary for range-for, and these are effectively C++ forward_iterators,
which allow copying, so I don't see a reason to prevent it. A bit more
would need to be done to make them actually conform as C++11 forward
iterators, but I don't think we particularly want to #include <iterator>
yet.
gcc/cp/ChangeLog:
* cp-tree.h (class ovl_iterator): Allow copying. Add op==.
(class ovl_range, class lkp_range): New.
* call.c (build_op_call_1, add_candidates): Use them.
(build_op_delete_call, has_trivial_copy_assign_p): Likewise.
(has_trivial_copy_p): Likewise.
* class.c (handle_using_decl, get_basefndecls): Likewise.
(maybe_warn_about_overly_private_class): Likewise.
(warn_hidden, add_implicitly_declared_members): Likewise.
(check_methods, clone_constructors_and_destructors): Likewise.
(type_has_user_nondefault_constructor): Likewise.
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions