|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-07 00:35:08
Andrey Semashev wrote:
> To convert all the checks that are done in runtime with the code I presented
> earlier you would have to convert that loop to a series of statements such as
> this:
>
> x[ 0 ] = detail::read32le( block.subspan<0, 4>() );
> x[ 1 ] = detail::read32le( block.subspan<4, 4>() );
> x[ 3 ] = detail::read32le( block.subspan<8, 4>() );
> x[ 4 ] = detail::read32le( block.subspan<12, 4>() );
> // ...
> x[ 15 ] = detail::read32le( block.subspan<60, 4>() );
>
> Or perform some kind of tricks with variadic templates and fold expressions.
You can write this with mp_for_each, but it's not necessary because
compilers figure out the for loop easily: https://godbolt.org/z/d861cPf1K
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk