摘要: unique_ptr, shared_ptr 以及weak_ptr 1. example unique_ptr 与所指对象的内存绑定紧密,不能与其他unique_ptr类型的指针对象共享所值对象的内存。up2不能分享up1的所有权。这种所有权只能通过move()函数来转移。 shared_ptr允许 阅读全文
posted @ 2019-08-30 18:33 c++11 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 1. 枚举:分本别类和数值的名字 程序中需要“数值的名字”时,有三种方式实现: (1)宏 #define Male 0 #define Female 1 (2)匿名的enum enum { Male, Female }; (3)静态常量 const static int Male = 0; cons 阅读全文
posted @ 2019-08-30 12:21 c++11 阅读(2015) 评论(0) 推荐(1) 编辑