7

如何理解 unique_ptr 的定义?

 3 years ago
source link: https://www.zhihu.com/question/465465935/answer/1944855796
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何理解 unique_ptr 的定义?

哪里有开源软件里C++ template 使用实例? 内图片中包含如下代码,怎么理解,我读不懂啊,:: 在这里啥意思?还有 using _Delete…
12
1,266
登录后你可以
不限量看优质回答私信答主深度交流精彩内容一键收藏
C++程序猿, 公众号:高级开发者

这个using是作为alias使用的,避免你需要敲一大堆字符。

template <typename _Up>
using _DeleterConstraint = typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;

使用只需要写_DeleterConstraint<T>来代替一长串的typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK