Avoiding __restrict__ loss when using GSL passes

I (mainly), as a new initiative on the main C ++ initiatives, and what the "Support Support" offers. In particular, I want to use spanmore. However, I encounter a problem __restrict__that is not part of C ++ when I want / should use it.

To be more specific: without span, I would declare:

void foo(int* __restrict__ p, size_t len);

But if I now declare:

void foo(gsl::span<int> s);

I do not get the effect __restrict__if my compiler is not super-smart. I can very strongly pray to the gods gcc / clang / msvc and say:

void foo(gsl::span<int> __restrict__ s);

or, alternatively, I could set up the implementation of GSL span<T>, to pointers T* beginand T* endwere themselves __restrict__' ed. However, it is not necessary at all , this will be respected.

So can I get an ion __restrict__? Or should I just give it up? This view takes fun from switching to span's ...

+4
source share

All Articles