https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108487

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0
      Known to fail|                            |10.4.0, 11.1.0, 14.2.0

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We still don't have code to make this more efficient (that would be Bug 100070)
but the correct way to construct a vector from iota_view is C++23's
std::ranges::to

Adding this function:

__attribute__((noinline)) std::vector<int> fn3(int n)
{
  return std::ranges::to<std::vector<int>>(std::ranges::iota_view{0, n});
}

And then calling it from main() I get:

3678697
35870273
3000809

So this is significantly better than the naive loop.

Reply via email to