I'm trying to implement a priority_queue
which holds A<T>
objects and use a custom Compare
method/type. According to the reference example, this is my code:
template <class T>
class A{
T value;
A(T _value):value(_value){}
};
template <class T>
class ProblematicClass{
auto cmp = [](A<T>* l, A<T>* r) {return l->value > r->value; };
std::priority_queue < A<T>*, std::vector<A<T>*>, decltype(cmp) > q(cmp);
};
But I'm getting the following error:
error C2853: 'cmp' : a non-static data member cannot have a type that contains 'auto'
I tried to make lamda definition static
, but it results in a new syntax error:
error C2143: syntax error : missing '}' before 'return'
Can you please help me with it?
UPDATE: I'm using VS2013