I am following this answer to define a priority_queue with a lambda function. However, I am running to: error: lambda-expression in unevaluated context
#include <bits/stdc++.h>
int main()
{
std::priority_queue<
int,
std::vector<int>,
decltype( [](int a, int b)->bool{
return a>b;
})>
q;
}
Your code is valid C++20 as written but invalid C++11.
decltype
) before C++20.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With