看到文章里的同学留言说到unique_ptr,这两天看了一下cplusplus提供的reference才知道这个东西是c++11的新特性,对c++11的新特性不是很了解,花时间了解了下unique_ptr,之前有写过auto_ptr的分析,这里就和auto_ptr对比下来看。

  • unique_ptr的构造函数与auto_ptr一样,采用explicit声明,防止复制/拷贝时不必要的类型转换,在定义对象时必须显示调用初始化式,不能使用赋值操作符进行隐式转换。
  • unique_ptr同样要重复释放指针的可能:
     int _tmain(int argc, _TCHAR* argv[])
    {
    int *p = new int();
    unique_ptr<int> up(p);
    unique_ptr<int> up2(p); return ;
    }

    up析构时,已经将p指针delete,而up2析构会重复delete,出现未定义操作。auto_ptr析构函数只是单纯的delete掉raw指针,而unique_ptr则可以定制自己的deleter,来指定unique_ptr析构时需要做哪些工作。默认情况下unique_ptr使用的deleter如下:

     void operator()(_Ty *_Ptr) const _NOEXCEPT
    { // delete a pointer
    static_assert( < sizeof (_Ty),
    "can't delete an incomplete type");
    delete _Ptr;
    }

    可以看出这是一个函数对象,功能很简单,delete raw指针。开发人员可以定制自己的deleter,一个很简单的例子:

     struct my_deleter
    {
    void operator()(int *p)
    {
    cout<<"delete point, value = "<<*p<<endl;
    delete p;
    }
    };
    int _tmain(int argc, _TCHAR* argv[])
    {
    unique_ptr<int, my_deleter> up(new int(), my_deleter()); return ;
    }
  • auto_ptr只能托管单独的指针,而不能用于堆上动态分配的数组。而unique_ptr则可以用于数组:
     struct Item
    {
    Item(){cout<<"Construct "<<endl;}
    ~Item() {cout<<"Destruct"<<endl;}
    };
    int _tmain(int argc, _TCHAR* argv[])
    {
    Item *par = new Item[];
    unique_ptr<Item[]> uparr(par); return ;
    }

    在vs2012中运行上面的代码结果如下,根据输出中五个"Destruct"可以看出uparr对象在析构时调用了delete[]:aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhgAAAEBCAIAAAC110uJAAAgAElEQVR4nO2dSXMc6Z2f80s4whG++GJH2GF/C2lEtNhqaj7AnHxw2AfP9GgkNTvU7HGL0snRVmusJgm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ADARYFIAAAAXIqTTt238sC3ApEAAAC4EBAJAACAS8GLhAQiAQAA0BecSHidQCQAAAC0IxEJcQlEAgAAQCsQCQAAgEshF4lv5UEtBZEAAADQhqJI6hAJAAAAjZx06r6VYYgEAADABYFIAAAAXAqIBAAAwKU46dT9q8O+1WGhTiASAAAAWjnp1P2rIxAJAACAC0JEIilKIBIAAABaOenU/Wsj/jXOJRAJAACAfuBFsjbCtXFBJAAAALQiEQmpSyASAAAAWhGJhC1K6ik/RAIAAEATUpGsjfhXRyASAAAAWoFIAAAAXIqTTj0gEckaRAIAAEAzJ0dKIklDJAAAALRBRBKASAAAAFyI/w800Iux9e0/TgAAAABJRU5ErkJggg==" alt="" />

  • auto_ptr对象可以进行拷贝和赋值,之后源对象不再拥有raw指针的所有权,转而交给新对象托管。unique_ptr对象禁止拷贝和赋值运算,在vs2012源码中,将拷贝构造函数和赋值操作符声明为private,并未定义,所以如下代码中,line5,6两行均会导致编译报错:
     int _tmain(int argc, _TCHAR* argv[])
    {
    int *p = new int();
    unique_ptr<int> up(p);
    unique_ptr<int> up_copy(up);
    unique_ptr<int> up_assign;
    up_assign = up; return ;
    }

    因为此特性,猜想unique_ptr对象无法很好地与STL容器一起使用(PS:最初我以为将拷贝构造和赋值操作符私有化的类,声明一个容器持有这种类型,这样的代码编译就会报错,编码后才知道编译不会报错,调用push_back等需要拷贝或赋值的操作时,才会报错),下面代码中line5将会报错:

     int _tmain(int argc, _TCHAR* argv[])
    {
    unique_ptr<int> up(new int());
    vector<unique_ptr<int> > vup;
    vup.push_back(up); return ;
    }

    之后了解到c++11中引入的move语义使得unique_ptr可以存放到容器中,参考这篇文章http://www.th7.cn/Program/cp/201408/267890.shtml。使用move就表示放弃对该对象的所有权,但并不对raw指针进行释放,举个例子:

     int _tmain(int argc, _TCHAR* argv[])
    {
    vector<unique_ptr<int, my_deleter> > vup;
    {
    cout<<"scope begin######################"<<endl;
    unique_ptr<int, my_deleter> up(new int(), my_deleter());
    vup.push_back(move(up));
    if(up.get() == NULL)
    cout<<"up points NULL"<<endl;
    cout<<"scope end######################"<<endl;
    }
    cout<<"outer######################"<<endl; return ;
    }

    根据下面的输出可以验证,在局部对象up经过move函数调用后,失去了对raw指针的所有权(line9),并未释放raw指针,之后如果误用了up对象,会导致undefine行为:

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf8AAAD0CAIAAAAaI7ieAAAgAElEQVR4nO2dWXNbSXqm80fY4YmYm7mxIxxh/wp3tSW1VKX2D/D1xDhiPF3dHT0lTZfUXaWum5npcbVdVdx3UqKohSS4AOCChQC4YQfOwb7vO3dKVEXPRebZFwAkKFHA98QbisNk4uAQVXi/zC839Fd/9Vd/8Rd/+Xd/81/+/m//eqT/u/Pjg/Pjg7enRx3Rm9NDSeEhqzeyOpGTpBpzE4W3PmtZTV91+T//UKyTw7cnB6zeyKhBdNyK6jI6UtT5Ue2NROcqOqydH1axzlgdVNR12ihfWid81UUqdUb8d+Q/+WH1jPlju0mi/2QKH7v6JybWaaN0lf/KN0RnSjq4hJp8Ka5NVeE1o8OWdH5YRX/xF3/5n//TX44N9h1VcqWII+cz53zmrNckkEegjMeUcRvlZMq4TRmPKcPWdJuyHnPWY856Jff0mjIeo6zSHkPaLZUx4zFm3KQOeSqvCT9w3mfO+7cKfkuBshQpS4GyFmiiImUt0gqihKKtRdpSpC28ChY5bRX8IpmJfFimgs+U95nyPmPea8x7DHmPIefezLk3c66NrGs961zPOtcyzrWMU5+x6xhp03Zten+V0Up6jyi1t5zaXU7tLqV2l1I7GqzkzmJyZzG5vZjcXkhuLyRtCwnbfAL/a51PWF8nbK8T1tcJ6+u49RWR5WWC6EV8SyLzXMw8FzM/j5mfx8yzUeNsxDgbMT6LGJ6FDTOhzeng5nRwYyq4PhVYmwqsTQbWJrBo/QStn6B045Ru3K8dE2qU0YhvZcS7POxdHvIuD3mWBz3Lgx7NoEcz4NYMuDUDrsUB52If0UKfc77POd/nIPqB0feO10R2ou+w9l8piq1jf/29Y/4H50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KAX4bk/FwDA/QEAALocofv3gfsDAAD0BCL3d4H7AwAA9AIS9+9zgfsDAAB0Pfh0F3B/AACA3uK0UXYv9rkX+/gxAOb7AwAAdDnkXN/FfnB/AACAHoJ1f37zH9wfAACgy+G5PxcAwP0BAAC6HHB/AACAXkTo/iQAgPsDAAB0ORL373eD+wMAAHQ94P4AAAA9yP8H72Isy0X0oksAAAAASUVORK5CYII=" alt="" />

    这里需要注意的是,此处move函数调用了unique_ptr的move语意拷贝构造函数(不知道c++11是否这么称呼……),注意形参类型为unique_ptr&&

     unique_ptr(unique_ptr&& _Right) _NOEXCEPT
    : _Mybase(_Right.release(),
    _STD forward<_Dx>(_Right.get_deleter()))
    { // construct by moving _Right
    }

    这里确实没有调用deleter,进行raw指针的释放。forward函数同样是c++11里的语法,表示”接受一个参数,然后返回该参数本来所对应的类型的引用”。

  目前对unique_ptr的了解就到这里,不算太深,可以看出unique_str的功能比auto_ptr更为强大,它支持托管堆上分配的数组,支持定制deleter,并且可以通过move语意使unique_ptr对象与容器兼容,但仍然有一些不足,比如重复释放,使用move语意之后源对象失去了对raw指针的管理权,再次使用会出现undefine行为。要避免这些情况,除了使用时要注意之外,最好的办法还是使用带有引用计数功能的智能指针。

unique_ptr简谈的更多相关文章

  1. .NET简谈接口

    自从面向对象开发方式的出现,抽象的概念就开始日新月异的发展,面向对象编程.面向接口编程.面向组件编程等等:这一系列的概念都是软件工程所追求的思想范畴,高类聚低耦合. 今天我要简谈的是面向对象里面非常重 ...

  2. .NET简谈构件系统开发模式

    转自[王清培] http://www.cnblogs.com/wangiqngpei557/archive/2011/06/14/2080416.html 在本人的“.NET简谈插件系统开发模式”一文 ...

  3. .NET简谈——跨进高级编程门槛的必经之路

    我们继续C#基础知识的学习,这篇文章对前面基础知识学习的朋友有着举足轻重的作用:为了延续基础知识学习的热情,我编写了这篇特殊的文章. 本篇文章的中心是想借“.NET简谈反射(动态调用)”一文继续发挥下 ...

  4. 简谈Java语言的继承

    Java语言的继承 这里简谈Java语言的三大特性之二——继承. Java语言的三大特性是循序渐进的.是有顺序性的,应该按照封装-->继承-->多态这样的顺序依次学习 继承的定义 百度百科 ...

  5. 简谈Java语言的封装

    简谈Java语言的封装 封装的定义 封装将复杂模块或系统的逻辑实现细节隐藏,让使用者只需要关心这个模块或系统怎么使用,而不用关心这个模块或系统是怎么实现的. 在面向对象的的编程中,我们一般通过接口来描 ...

  6. MPI简谈

    MPI简谈 MPI是分布式内存系统,区别于OpenMP和Pthreads的共享内存系统.MPI是一种基于消息传递的并行编程技术,是如今最为广泛的并行程序开发方法. MPI前世今生 MPI(Messag ...

  7. ASP.NET MVC 网站开发总结(六)——简谈Json的序列化与反序列化

    首先,先简单的谈一下什么是序列化与反序列化,序列化 (Serialization)将对象的状态信息转换为可以存储或传输的形式的过程.在序列化期间,对象将其当前状态写入到临时或持久性存储区.以后,可以通 ...

  8. 简谈HTML5与APP技术应用

    HTML5到底能给企业带来些什么? HTML5是近年来互联网行业的热门词汇,火的很.微软IE产品总经理发文: 未来的网络属于HTML5.乔布斯生前也在公开信<Flash之我见>中预言:像H ...

  9. 简谈WP,IOS,Android智能手机OS

    什么是智能手机? 相信到现在这个已经是傻瓜到不能再傻瓜的问题了 智能手机都不懂? 那你活着还有什么意思= = 但是为了谈论今天的三大主角:wp,ios,android 不得不回答一下这个笨笨的问题 如 ...

随机推荐

  1. C#管理控制IIS7的方法

    原文:C#管理控制IIS7的方法 转自 http://www.lob.cn/jq/csyy/7285.shtml 把在找到正确方法前遇到的挫折也拿出来与大家分享,相信不少朋友从iis6到iis7的过渡 ...

  2. Pro Aspnet MVC 4读书笔记(1) - Your First MVC Application

    Listing 2-1. The default contents of the HomeController class using System; using System.Collections ...

  3. Object-c中间initialize 与 辛格尔顿

    简单说下initialize任务.在初始化过程中同样的类将被调用一次. 直接在代码解释initialize任务. 创建一个InitTest类 InitTest.m #import "Init ...

  4. Learning JavaScript(0)_Concepts

    作用域,嵌套函数和闭包 <script type="text/javascript"> function foo(){ var a = 10; function bar ...

  5. hdu 1814 Peaceful Commission (2-sat 输出字典序最小的路径)

    Peaceful Commission Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  6. c++的string容器

    c++相比c的一个好处就是实现了很多的容器和泛型算法,使得程序员的工作得到了很大的化简.其中一个很有用的泛型容器就是string.string是一个类,是一个在STL里边实现好了的类,由于他的很多功能 ...

  7. Chapter 2 User Authentication, Authorization, and Security(3):保server避免暴力袭击

    原版的:http://blog.csdn.net/dba_huangzj/article/details/38756693,专题文件夹:http://blog.csdn.net/dba_huangzj ...

  8. 详解JMeter函数和变量

    JMeter函数可以被认为是某种特殊的变量,它们可以被采样器或者其他测试元件所引用.函数调用的语法如下: ${__functionName(var1,var2,var3)} 其中,__function ...

  9. Windows Phone 8.1 应用生命周期

    原文:Windows Phone 8.1 应用生命周期 一.“后退键”不会终止应用 关于 Windows Phone 8.1 的应用生命周期,第一个要知道的关键就是:“后退键”不会终止应用! 在 8. ...

  10. Cgroup maintainer丽泽范:解剖Linux核心容器技术

    摘要:Cgroup和namespace等内核特性如何出现,在社区处于如何的开发状况?Docker如火如荼.内核社区是否会因此加紧完好容器技术的隔离性安全性?华为Linux内核高级project师李泽帆 ...