std::ranges::remove,std::ranges::remove_if C++ Algorithm library Constrained algorithms, e.g.ranges::copy,ranges::sort, ... Constrained algorithms Defined in header<algorithm> Call signature (1) template<std::permutableI,std::sentinel_for<I>S, ...
the following simple code fails to compile with clang (15, 14, 13, 12, ..) but compiles with gcc and msvc: #include <vector> #include <algorithm> void test_remove_if() noexcept { std::vector<int> vec; std::ranges::remove_if(vec, [](int v) { return !v; }); } code on ...
const std::string_view str {"#Small #Buffer #Optimization"}; std::cout << "before: " << std::quoted(str) << '\n'; std::cout << "after: \""; std::ranges::remove_copy(str.begin(), str.end(), std::ostream_iterator<char>(std::cout), '#'); std::cout << "\"\n"; ...