PR libstdc++/121402
libstdc++-v3/ChangeLog:
* include/std/ranges (repeat_view::_M_value): Add
[[no_unique_address]].
* testsuite/std/ranges/adaptors/sizeof.cc
[__cpp_lib_ranges_repeat]: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
&& (__detail::__is_integer_like<_Bound> || same_as<_Bound, unreachable_sentinel_t>)
class repeat_view : public view_interface<repeat_view<_Tp, _Bound>>
{
- __detail::__box<_Tp> _M_value;
+ [[no_unique_address]] __detail::__box<_Tp> _M_value;
[[no_unique_address]] _Bound _M_bound = _Bound();
class _Iterator;
namespace ranges = std::ranges;
+struct Empty { };
+
auto pred_f(int x) { return x%2 == 0; };
auto pred_l = [] (int x) { return x%2 == 0; };
#if __cpp_lib_ranges_slide
static_assert(sizeof(ranges::slide_view<V>) == 3*ptr);
#endif
+
+#if __cpp_lib_ranges_repeat
+static_assert(sizeof(ranges::repeat_view<Empty, size_t>) == 1*ptr);
+#endif