当前位置:   article > 正文

C++ //练习 12.14 编写你自己版本的用shared_ptr管理connection的函数。

C++ //练习 12.14 编写你自己版本的用shared_ptr管理connection的函数。

C++ Primer(第5版) 练习 12.14

练习 12.14 编写你自己版本的用shared_ptr管理connection的函数。

环境:Linux Ubuntu(云服务器)
工具:vim

 

代码块
struct destination;
struct connection;

connection connect(destination *);

void disconnect(connection);

void end_connection(connection *p){
    disconnect(*p);
}

void f(destination &d){
    connection c = connect(&d);
    shared_ptr<connection>p (&c, end_connection);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/463402
推荐阅读
相关标签
  

闽ICP备14008679号