[PATCH] libstdc++: Include range_access.h from <simd>
Jonathan Wakely
jwakely@redhat.com
Fri Oct 9 12:01:11 GMT 2026
On Fri, 9 Oct 2026 at 10:02, Tomasz Kamiński <tkaminsk@redhat.com> wrote:
> This implements LWG4385, "Including <simd> doesn't provide
> std::begin/end".
>
> libstdc++-v3/ChangeLog:
>
> * include/std/simd: Include <bits/ranges_access.h>.
> Use angled instead of quoted includes.
> * testsuite/std/simd/traits_common.cc: Add test for
> calling non-member begin, end, size, ....
>
OK
> ---
> libstdc++-v3/include/std/simd | 17 +++++++++--------
> .../testsuite/std/simd/traits_common.cc | 8 ++++++++
> 2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/simd b/libstdc++-v3/include/std/simd
> index 0523fce3baf..a64a8beaf0b 100644
> --- a/libstdc++-v3/include/std/simd
> +++ b/libstdc++-v3/include/std/simd
> @@ -39,16 +39,17 @@
>
> #ifdef __glibcxx_simd
>
> -#include "bits/simd_vec.h"
> -#include "bits/simd_loadstore.h"
> -#include "bits/simd_mask_reductions.h"
> -#include "bits/simd_reductions.h"
> -#include "bits/simd_alg.h"
> -#include "bits/simd_bit.h"
> +#include <bits/simd_vec.h>
> +#include <bits/simd_loadstore.h>
> +#include <bits/simd_mask_reductions.h>
> +#include <bits/simd_reductions.h>
> +#include <bits/simd_alg.h>
> +#include <bits/simd_bit.h>
> #ifdef __glibcxx_simd_complex
> -#include "bits/simd_complex.h"
> +#include <bits/simd_complex.h>
> #endif
> -#include "bits/simd_math.h"
> +#include <bits/simd_math.h>
> +#include <bits/range_access.h>
>
> #endif
> #endif
> diff --git a/libstdc++-v3/testsuite/std/simd/traits_common.cc
> b/libstdc++-v3/testsuite/std/simd/traits_common.cc
> index 2adaff335b4..b83cf56ecf2 100644
> --- a/libstdc++-v3/testsuite/std/simd/traits_common.cc
> +++ b/libstdc++-v3/testsuite/std/simd/traits_common.cc
> @@ -372,6 +372,14 @@ static_assert([] { simd::vec<float> x = {}; return
> x.begin() - x.end(); }() == -
> static_assert([] { simd::vec<float> x = {}; return x.begin() - x.begin();
> }() == 0);
> static_assert([] { simd::vec<float> x = {}; return x.begin() + 1 -
> x.begin(); }() == 1);
> static_assert([] { simd::vec<float> x = {}; return x.begin() + 1 -
> x.cbegin(); }() == 1);
> +
> +static_assert([] { simd::vec<float> x = {}; return std::begin(x) +
> std::size(x) == std::end(x); }());
> +static_assert([] { simd::vec<float> x = {}; return std::cend(x) ==
> std::cbegin(x) + std::size(x); }());
> +static_assert([] { simd::vec<float> x = {}; return std::ranges::begin(x)
> + std::ranges::size(x) == std::ranges::end(x); }());
> +static_assert([] { simd::vec<float> x = {}; return std::ranges::cend(x)
> == std::ranges::cbegin(x) + std::ranges::size(x); }());
> +static_assert([] { simd::vec<float> x = {}; return std::ranges::rbegin(x)
> + std::ranges::size(x) == std::ranges::rend(x); }());
> +static_assert([] { simd::vec<float> x = {}; return std::ranges::crend(x)
> == std::ranges::crbegin(x) + std::ranges::size(x); }());
> +
> #endif
>
> // mask to vec ///////////////////////
> --
> 2.55.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20261009/0addf6d9/attachment.htm>
More information about the Gcc-patches
mailing list