On Mon, 18 May 2026 at 13:24, Tomasz Kamiński <[email protected]> wrote:
>
> This implements <valarray> related parts of section 4.7. of P3016R6.
> This is treated as DR against C++11 (to expose array begin/end), to follow
> similar changes to other semi-containers that were accepted as LWG issues
> and treated as DR: <optional> (LWG4131), <stacktrace> (LWG3625).
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/valarray [__cplusplus >= 201103L]: Include
>         <bits/ranges_access.h>.
> ---
> I think it is OK to backport that, as what gets included, in addition
> to what is specified in standard is already non-portable. And cbegin
> (that is defined in terms of std::begin), already worked for valarray.
>
> Testing on x86_64-linux. *valarray* test already passed.
> OK for trunk?

OK


>
>  libstdc++-v3/include/std/valarray                  |  1 +
>  .../26_numerics/valarray/range_access2.cc          | 14 +++++++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/valarray 
> b/libstdc++-v3/include/std/valarray
> index 63784fb5974..abb158d22c3 100644
> --- a/libstdc++-v3/include/std/valarray
> +++ b/libstdc++-v3/include/std/valarray
> @@ -43,6 +43,7 @@
>  #include <debug/debug.h>
>  #if __cplusplus >= 201103L
>  #include <initializer_list>
> +#include <bits/range_access.h>
>  #endif
>
>  namespace std _GLIBCXX_VISIBILITY(default)
> diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/range_access2.cc 
> b/libstdc++-v3/testsuite/26_numerics/valarray/range_access2.cc
> index 8a4f2b659e5..44ea7fc4b60 100644
> --- a/libstdc++-v3/testsuite/26_numerics/valarray/range_access2.cc
> +++ b/libstdc++-v3/testsuite/26_numerics/valarray/range_access2.cc
> @@ -19,7 +19,6 @@
>
>  // C++11 26.6.10 valarray range access: [valarray.range]
>
> -#include <iterator>
>  #include <valarray>
>
>  // PR libstdc++/67374
> @@ -46,8 +45,21 @@ test02()
>    (void) std::cend(cva);
>  }
>
> +// P3016R6 4.8
> +void
> +test03()
> +{
> +#if __cplusplus >= 201703L
> +  std::valarray<double> va;
> +  (void) std::size(va);
> +  const auto& cva = va;
> +  (void) std::size(cva);
> +#endif
> +}
> +
>  int main()
>  {
>    test01();
>    test02();
> +  test03();
>  }
> --
> 2.54.0
>

Reply via email to