gcc/libstdc++-v3/testsuite/std/ranges
Patrick Palka 361e32eeaa libstdc++: Rearrange some range adaptors' data members
Since the standard range adaptors are specified to derive from the empty
class view_base, having their first data member store the underlying
view is suboptimal, for if the underlying view also derives from
view_base then the two view_base subobjects will be adjacent; this
prevents the compiler from applying the empty base optimization to elide
away the storage for these two empty bases.

This patch improves the situation by declaring the _M_base data member
last instead of first in each range adaptor that has more than one data
member, so that the empty base optimization can apply in more cases.

libstdc++-v3/ChangeLog:

	* include/std/ranges (filter_view): Declare the data member
	_M_base last instead of first, and adjust constructors' member
	initializer lists accordingly.
	(transform_view): Likewise.
	(take_view): Likewise.
	(take_while_view): Likewise.
	(drop_view): Likewise.
	(drop_while_view): Likewise.
	(join_view): Likewise.
	(split_view): Likewise (and tweak nearby formatting).
	(reverse_view): Likewise.
	* testsuite/std/ranges/adaptors/sizeof.cc: Update expected
	sizes.
2020-09-28 12:05:32 -04:00
..
access
adaptors libstdc++: Rearrange some range adaptors' data members 2020-09-28 12:05:32 -04:00
headers/ranges
iota libstdc++: Reduce the size of an unbounded iota_view 2020-09-28 11:54:57 -04:00
subrange libstdc++: Reduce the size of a subrange with empty sentinel type 2020-09-28 11:55:04 -04:00
empty_view.cc
istream_view.cc
range.cc
refinements.cc
safe_range_types.cc
safe_range.cc
single_view.cc
sized.cc
view.cc