1. When I created a member type of multiset for the class Basket, there was a problem specifying that the compare was constructed using multiset
.
2. The program code is as follows:
class Basket
{
private:
static bool comp(const std::shared_ptr<Quote> &lhs,
const std::shared_ptr<Quote> &rhs);
std::multiset<std::shared_ptr<Quote>, decltype(comp) *>
_items{comp};
/*
error: "comp" is not a type
_items(comp);
std::multiset<std::shared_ptr<Quote>, decltype(comp) *>
_items(comp);
*/
}
3. Compile instruction:
gPP -s -std=cPP11 -w -Wall -Werror quote.cc -o quote.so
4. Error message:
calling the constructor of multiset with () will make an error, but it will be correct with {}. What is the reason for this?
quote.h:226:24: error: "comp" is not a type
_items(comp);