看起来显而易见,所以我重载了相等运算符,但它还在抱怨:
template <typename T>
class FDataStreamSubscriber
{
friend class FDataStream<T>;
private:
FDataStreamSubscriber(FDataStream<T>* InStream)
: ParentStream(InStream), LastGetTime(0.0f), SubscriberId(FGuid::NewGuid()) { }
public:
bool GetIfNew(T& OutData);
T* GetDataPtr();
void Unsubscribe();
friend bool operator==(const FDataStreamSubscriber& Left, const FDataStreamSubscriber& Right)
{
return Left == Right;
}
const bool operator==(const FDataStreamSubscriber<T>& Other) const
{
return this->SubscriberId == Other.SubscriberId;
}
private:
FDataStream<T>* ParentStream;
FGuid SubscriberId;
float LastGetTime;
};
然而它仍然给我错误:
note: while trying to match the argument list '(FDataStreamSubscriber<T>, const FDataStreamSubscriber<T>)
如果我将重载更改为该参数列表,则表示运算符不明确。我不能赢!
(参见其余部分:http://pastebin.com/TUFwvpMr)