on-internet
← Community

Intellisense flags std::ranges::fold_left even though the code compiles fine

Stack Overflow ·

Consider this C++23 code with modules enabled. import std; static int vector_total(const std::vector<int>& v) { return std::ranges::fold_left(v, 0, std::plus{}); } int main() { const std::vector vec{1, 2, 3}; const int res = vector_total(vec); std::println("Total: {}", res); return 0; } I am writing code in Visual Studio 2026 Community and the code compiles fine and the output is as you'd expect. Total: 6 The problem is that Intellisense flags std::ranges::fold_left with this error: no instance of overloaded function "std::ranges::_Fold_left_fn::operator()" matches the argument list I tried to

Comments

Sign in or sign up to comment and upvote.

No comments yet.