C ++长错误消息我无法解决

问题描述 投票:0回答:2

enter image description here

我得到这个消息,它只是持续多年,我不明白为什么。它说模板使用可能有问题,但我不认为我做错了什么:

using std::shared_ptr;
using std::set;

class User{
    set<CoinBalance> holdings;
    ApiConnection api;

public:
    void newHolding(const shared_ptr<Coin>&, double amount = 0);
    void addToHolding(const shared_ptr<Coin>&, double amount = 0);
    void decreaseFromHolding(const shared_ptr<Coin>&, double amount = 0);

    double getHondingsUsdValue();
};

这就是我使用shared_ptr的方式:

class CoinBalance {
    shared_ptr<Coin> coin;
    double amount;
};
c++ clion
2个回答
1
投票

是的,你需要为CoinBalance实现<operator


0
投票

我认为你必须为类CoinBalance实现运算符'<'。

© www.soinside.com 2019 - 2024. All rights reserved.