https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108714
Bug ID: 108714
Summary: Algorithms in <algorithm> require predicates to be
copyable
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: b.stanimirov at abv dot bg
Target Milestone: ---
Simple repro:
```
#include <algorithm>
#include <vector>
struct noncopyable {
noncopyable();
noncopyable(const noncopyable&) = delete;
noncopyable(noncopyable&&) noexcept = default;
template <typename T>
bool operator()(const T&);
};
bool all_of_vec(const std::vector<int>& vec) {
return std::all_of(vec.begin(), vec.end(), noncopyable{});
}
```
This does not compile, because the predicate to `all_of` is not copyable. The
same error appears for all other algorithms which allow a predicate.
It does compile and work and expected with Microsoft STL and with libc++
Live demo showing compilation errors with libstdc++ and successful compilation
with libc++ and Microsoft STL: https://godbolt.org/z/xaa35G35e