C++ standard wording: Does “through all iterators in the range” imply sequentiality?

前端 未结 2 928
野趣味
野趣味 2020-12-06 04:17

This SO question sparked a discussion about std::generate and the guarantees made by the standard. In particular, can you use function objects with internal sta

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 04:59

    In the discussion of LWG475, std::for_each is compared with std::transform. It's noted that "transform does not guarantee the order in which its function object is called". So, yes, the committee is aware of the lack of sequential guarantees in the standard.

    There is no opposite requirement for non-sequential behavior either, so Microsoft and Apache are free to use sequential evaluation.

提交回复
热议问题