#1822

ranges::transform cannot be compiled with c++17

Openhj2000opened 2y ago

Can you explain why ranges::tranform can be compiled with c++20, but failed to be compiled with c++17?

#include <algorithm>
#include <cmath>
#include <iterator>
#include <set>
#include <range/v3/algorithm.hpp>

int main () {
    std::vector<double> a{1.5,2.5,3.5};
    std::set<double> b;

    std::ranges::transform( a, std::inserter( b, b.begin() ), 
        []( double v ) -> double { return std::round( v ); } ); // compiles with c++20
    ranges::transform( a, std::inserter( b, b.begin() ), 
        []( double v ) -> double { return std::round( v ); } ); // compiles with c++20, but does not compile with c++17

    return 0;
}

gcc version: 14.1 range-v3 version: 0.12.0

Activity

0

No activity yet.