Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
std::unique_ptr
是否需要知道 T 的完整定义?
我的标题中有一些代码 如下所示 include
c
visualstudio2010
C11
STL
uniqueptr
指向 STL 容器的指针安全吗?
如果我做一个怎么办unique ptr指向一个STL容器的实例 如下所示 这段代码安全吗 unique ptr lt vector
c
C11
smartpointers
uniqueptr
带有向量的 unique_ptr:错误:调用 XXX 的隐式删除复制构造函数
我想管理一个二维数组 如下所示 std vector
c
C11
vector
uniqueptr
如何使具有 unique_ptr 成员的类与 std::move 和 std::swap 一起使用?
我有课 它有一个 unique ptr 成员 class A std unique ptr
c
uniqueptr
为什么 unique_ptr
隐式转换为 unique_ptr
?
我编写了以下使用的代码unique ptr
c
templates
inheritance
uniqueptr
为什么我不能从对中返回 unique_ptr?
为什么我不能从对中返回 unique ptr include
c
uniqueptr
rvaluereference
stdpair
perfectforwarding
通过右值引用获取参数的所有权
我想明确的是我的类的构造函数A将取得通过的所有权Data范围 显而易见的事情是采取unique ptr按价值 class A public A std unique ptr
c
C11
uniqueptr
rvaluereference
为什么不能使用initializer_list来初始化unique_ptr的向量? [复制]
这个问题在这里已经有答案了 我想知道为什么initializer list 不能与unique ptr 一起使用 std vector
c
C11
uniqueptr
initializerlist
unique_ptr需要存储删除器怎么可能没有开销呢?
先看看C Primer讲了什么unique ptr and shared ptr 16 1 6 美元 效率和灵活性 我们可以确定的是shared ptr不将删除者视为直接成员 因为删除器的类型直到运行时才知道 因为删除器的类型是a类型的一部
c
C11
smartpointers
uniqueptr
cstandardlibrary
在 std::vector
> 中迭代 const T&
我有一堂这样的课 class RPNExpr std vector
c
C11
vector
Iterator
uniqueptr
深拷贝和动态转换 unique_ptr
假设我有一个如下所示的类 class A virtual A class B public A class C public A 我还有一个 unique ptr 向量 它是这样声明的 std vector
c
C11
polymorphism
uniqueptr
deepcopy
Valgrind 在 std::make_unique 中显示内存泄漏
我正在使用 Valgrind 来检查内存泄漏 不幸的是我得到了Leak DefinitelyLost警告 附件是我的代码的简化版本 它重现了该错误 include
c
memoryleaks
undefinedbehavior
uniqueptr
virtualdestructor
返回 unique_ptr 私有成员数据而不转移所有权
Context 下面的错误似乎告诉我无法退回我的unique ptr called m head从这个获取函数 我只想归还我的unique ptr m head而不转移所有权 自从引入智能指针以来 我一直在完全避免使用原始指针 因为原始指针
c
smartpointers
uniqueptr
C++ 在地图中插入 unique_ptr
我有一个 C 类型的对象ObjectArray typedef map
c
pointers
Dictionary
STL
uniqueptr
单例模式和 std::unique_ptr
std unique ptr唯一地控制它指向的对象 因此不使用引用计数 单例确保利用引用计数只能创建一个对象 那么会std unique ptr与单例执行相同 单例确保只有一个实例属于一种类型 A unique ptr确保只有一个智能指针到
c
singleton
uniqueptr
将 unique_ptr 与 boost python 结合使用 - boost::shared_ptr 有效,但 unique_ptr 无效
这可能与以下问题相同 Boost Python 没有 to python for std unique ptr https stackoverflow com questions 20590205 boost python no to py
python
c
boost
boostpython
uniqueptr
没有适当的默认构造函数可用于 std::unique_ptr
这是我上一篇文章的延续 由于它已经关闭 我决定发表新帖子 我删除了一半的代码以使其更具可读性 我读过的一些帖子 使用 SDL 的智能指针 https stackoverflow com questions 24251747 smart po
c
SDL
uniqueptr
具有基类的唯一 ptr 的类的复制构造函数[重复]
这个问题在这里已经有答案了 当一个类具有基类的 unique ptr 时 实现复制构造函数的好方法是什么 让我尝试用一 个例子来解释它 struct Base virtual void doSth 0 to make the class a
c
uniqueptr
使用 std::unique_ptr
& 代替 std::unique_ptr
有什么优点吗?
使用有什么好处吗std unique ptr
c
uniqueptr
如何使用唯一指针向量?
I use vector
c
uniqueptr
1
2
3
4
5
6
7
»