是否实现定义了哪些算法可以接受可变的 lambda?

Is it implementation defined which algorithms can accept a mutable lambda?

我发现 lambda 是按值捕获的。这意味着如果一个算法在内部使用第二个算法来接受 lambda 的值,则 lambda 的任何可变状态都不会被保留。我将在此处重新发布我的链接问题示例:

remove_if(begin(values), end(values), [i = 0U, it = cbegin(intervals), end = cend(intervals)](const auto&) mutable {
    return it != end && ++i > it->first && (i <= it->second || (++it, true));
})

因此,在撰写我的原始问题时,remove_if 具有针对 mutable lambda 的实现定义行为。是否有实现定义的其他功能的列表?

是的,是的。 见 [algorithms.requirements]:

http://eel.is/c++draft/algorithms#requirements-9

[Note: Unless otherwise specified, algorithms that take function objects as arguments are permitted to copy those function objects freely. Programmers for whom object identity is important should consider using a wrapper class that points to a noncopied implementation object such as reference_wrapper, or some equivalent solution. — end note]