Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hj2000 opened this issue Jun 24, 2024 · 0 comments
Open

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

hj2000 opened this issue Jun 24, 2024 · 0 comments

Comments

@hj2000
Copy link

hj2000 commented Jun 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant