c++ - Why does std::views::take_while() do so many function invocations? (even with `cache_latest`) - Stack Overflow

I decided to use std::views stuff because of their bound-safety and readability. It looks like std::vie

I decided to use std::views stuff because of their bound-safety and readability. It looks like std::views::take_while invokes too many function calls and recomputes the same thing over and over again. This looks like a performance nightmare to me.

I thought the new std::views::cache_latest would be a solution, but testing my code with GCC (trunk) and Clang (trunk) showed otherwise.

In the following, std::views::take_while() invokes its lambda 68 times!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744071890a4553697.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信