N4296::25.2.4 [alg.foreach]
提供了函数std::for_each
:
template<class InputIterator, class Function> Function
for_each(InputIterator first, InputIterator last, Function f);
要求:功能应满足MoveConstructible的要求 (表20)。 [注意:功能不需要满足要求 CopyConstructible(表21)。 - 后注]
好的,现在MoveConstructible的内容如下:
Expression Post-condition
T u = rv; u is equivalent to the value of rv before the construction
T(rv) T(rv) is equivalent to the value of rv before the construction
rv’s state is unspecified [ Note:rv must still meet the requirements of the
library component that is using it. The operations listed in those requirements
must work as specified whether rv has been moved from or not. —end note ]
没有提及类型函数必须具有operator ()
成员函数,但事实上它必须。标准是否明确提到它?