cba9ef069e
This patch implements [range.adaptors]. It also includes the changes from P3280 and P3278 and P3323, without which many standard examples won't work. The implementation is mostly dictated by the spec and there was not much room for implementation discretion. The most interesting part that was not specified by the spec is the design of the range adaptors and range adaptor closures, which I tried to design in a way that minimizes boilerplate and statefulness (so that e.g. the composition of two stateless closures is stateless). What is left unimplemented is caching of calls to begin() in filter_view, drop_view and reverse_view, which is required to guarantee that begin() has amortized constant time complexity. I can implement this in a subsequent patch. "Interesting" parts of the patch are marked with XXX comments. libstdc++-v3/ChangeLog: Implement C++20 range adaptors * include/std/ranges: Include <bits/refwrap.h> and <tuple>. (subrange::_S_store_size): Mark as const instead of constexpr to avoid what seems to be a bug in GCC. (__detail::__box): Give it defaulted copy and move constructors. (views::_Single::operator()): Mark constexpr. (views::_Iota::operator()): Mark constexpr. (__detail::Empty): Define. (views::_RangeAdaptor, views::_RangeAdaptorClosure, ref_view, all_view, views::all, filter_view, views::filter, transform_view, views::transform, take_view, views::take, take_while_view, views::take_while, drop_view, views::drop, join_view, views::join, __detail::require_constant, __detail::tiny_range, split_view, views::split, views::_Counted, views::counted, common_view, views::common, reverse_view, views::reverse, views::__detail::__is_reversible_subrange, views::__detail::__is_reverse_view, reverse_view, views::reverse, __detail::__has_tuple_element, elements_view, views::elements, views::keys, views::values): Define. * testsuite/std/ranges/adaptors/all.cc: New test. * testsuite/std/ranges/adaptors/common.cc: Likewise. * testsuite/std/ranges/adaptors/counted.cc: Likewise. * testsuite/std/ranges/adaptors/drop.cc: Likewise. * testsuite/std/ranges/adaptors/drop_while.cc: Likewise. * testsuite/std/ranges/adaptors/elements.cc: Likewise. * testsuite/std/ranges/adaptors/filter.cc: Likewise. * testsuite/std/ranges/adaptors/join.cc: Likewise. * testsuite/std/ranges/adaptors/reverse.cc: Likewise. * testsuite/std/ranges/adaptors/split.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/adaptors/take_while.cc: Likewise. * testsuite/std/ranges/adaptors/transform.cc: Likewise. |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.