#include <boost/smart_ptr.hpp>
class Base {
};
class Derived : public Base {
public:
Derived() : Base() {}
};
void func(/*const*/ boost::shared_ptr<Base>& obj) {
}
int main() {
boost::shared_ptr<Base> b;
boost::shared_ptr<Derived> d;
func(b);
func(d);
}
Run Code Online (Sandbox Code Playgroud)
这用func的签名中的const编译,但不是没有它.该错误出现在呼叫的行中func(d);
有什么提示吗?