Nicola Gigante
Nicola Gigante

Reputation: 3266

Ranges algorithm in LLVM 14 libc++

I have this snippet.

#include <algorithm>
#include <vector>

int main() {
    std::vector<int> v1 = {1, 2, 3};
    std::vector<int> v2 = {4, 5, 6};

    return std::ranges::equal(v1, v2);
}

I compile it with GCC 10 (Debian stable) and everything's alright:

$ g++ -std=c++20 test.cpp -o test
<compiles fine>

I compile it with Clang 14 and libc++14 (Debian stable, installed from packages from apt.llvm.org):

$ clang++-14 -std=c++20 -stdlib=libc++ test.cpp -o test
test.cpp:8:25: error: no member named 'equal' in namespace 'std::ranges'
    return std::ranges::equal(v1, v2);
           ~~~~~~~~~~~~~^
1 error generated.

Same for a lot of other things. Is libc++ support for the ranges library really so behind or am I missing something?

Upvotes: 1

Views: 489

Answers (1)

463035818_is_not_an_ai
463035818_is_not_an_ai

Reputation: 122458

You can find an exhaustive table for implementations feature support here: https://en.cppreference.com/w/cpp/compiler_support

For C++20s "The One Ranges Proposal" where std::equal is part of the table says "13 (partial)".

There is another overview for clang here: https://clang.llvm.org/cxx_status.html#cxx20. Though it only lists language features.

Upvotes: 3

Related Questions