天天看点

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++

继续阅读