为什么需要两种形式?谢谢
explicit auto_ptr (T* ptr = 0) throw()
auto_ptr (auto_ptr& rhs) throw()
template<class Y>
auto_ptr (auto_ptr<Y>& rhs) throw()
auto_ptr& operator= (auto_ptr& rhs) throw()
template<class Y>
auto_ptr& operator= (auto_ptr<Y>& rhs) throw()
Run Code Online (Sandbox Code Playgroud) 如果你有一些变量(在堆栈上),你左或右位移超过它的结束会发生什么?
即
byte x = 1;
x >> N;
Run Code Online (Sandbox Code Playgroud)
如果x是一个指向内存转换为字节的指针而你做同样的事情怎么办?
byte* x = obtain pointer from somewhere;
*x = 1;
*x >> N;
Run Code Online (Sandbox Code Playgroud)