关于boost的智能指针
在boost的帮助中(shared_ptr 智能指针)
shared_ptr & operator=(shared_ptr const & r); // never throws
template<class Y> shared_ptr & operator=(shared_ptr<Y> const & r); // never throws
template<class Y> shared_ptr & operator=(std::auto_ptr<Y> & r);
那个template<class Y>是怎么回事啊!
难道说它什么类型的东西都可以接受吗?
同理:
在reset当中,有:
template<class Y> void reset(Y * p);
这也是什么类型都可以接受吗
难道遵循泛型原则就可以完全不顾及任何的类型了吗?
[解决办法]
理论上一个类型的析构不抛出异常都可以使用智能指针