I define a class named Quote and there is a multiset in it:
class Quote
{
public:
Quote()=default;
Quote(const std::string& book, double sales_price) :
bookNo(book), price(sales_price) {}
std::string isbn() const { return bookNo; }
private:
std::string bookNo;
static bool compare(const std::shared_ptr<Quote> &lhs, const std::shared_ptr<Quote> &rhs)
{
return lhs->isbn() < rhs->isbn();
}
std::multiset<std::shared_ptr<Quote>, decltype(compare)*> items(compare);
protected:
double price = 0.0;
};
But my IDE(Visual Studio) shows that function Quote::compare is not a type name
I usually initialize a set this way out of a class and it works well. Why that happens in a class? Thanks.