Boost logo

Boost :

From: Claudio DeSouza (cdesouza_at_[hidden])
Date: 2024-12-06 20:35:37


Correct, and that's why you `first<N>()` after, however the question is how
effective the compiler is at eliminating this temporary in between.

Claudio.

On Fri, Dec 6, 2024 at 7:07 PM Peter Dimov via Boost <boost_at_[hidden]>
wrote:

> Claudio DeSouza wrote:
> > The compiler can still see the max value being passed in and your example
> > block has a fixed extent. By using first<> you get another span of fixed
> extent.
>
> block has a fixed extent, but block.subspan(i * 4) does not.
>
> ...
>
> > > On 12/6/24 21:46, Claudio DeSouza via Boost wrote:
> > > > detail::read32le( block.subspan(i * 4).first<4>());
> > > >
> > > > So you also get a sized span, and avoid checks.
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk