天天看點

no known conversion for argument 1 from ‘[some_class]' to ‘[some_class]&’ 傳const引用而非引用 How come a non-const reference cannot bind to a temporary object?

 今天做list的疊代器時發現的問題

no known conversion for argument 1 from ‘[some_class]' to ‘[some_class]&’ 

解決方法,将==的參數傳遞方式改為(const &)

傳const引用而非引用:

原因:

How come a non-const reference cannot bind to a temporary object?

c++

繼續閱讀