摘要:
读《C++ Stragegies and Tacitics》的时候看到了一段很NB的代码,是关于智能指针的 (程序稍作修改,以便在编译器上运行): 1 #include <string> 2 using namespace std; 3 4 class String_ptr { 5 private: 6 string *ptr; 7 public: 8 String_ptr(string *s) : ptr(s) {} 9 string* operator ->() const {return ptr;}10 operator string*() const... 阅读全文