Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
是否存在具有单个强所有者和多个弱引用的共享指针?
我正在寻找类似于的智能指针Arc Rc只不过它不允许共享所有权 我想要尽可能多的rc Weak我需要的参考资料 但我只想one强引用 又称所有者 我想通过类型系统来强制执行这一点 Arc Rc可以克隆 并且可以在多个地方拥有它们 滚动我自己
Rust
smartpointers
为什么unique_ptr
::~unique_ptr需要T的定义?
如果我有一堂 酒吧 课 bar h class Bar public Bar 我转发声明与另一个类 Foo 中的 std unique ptr 一起使用 foo h include
c
C11
std
smartpointers
惯用使用 std::auto_ptr 还是只使用shared_ptr?
现在shared ptr是在 tr1 中 你认为使用应该会发生什么std auto ptr 它们都有不同的用例 但所有用例auto ptr可以用以下方法解决shared ptr 也 你会放弃吗auto ptr或者在您想明确表示在任何给定点只
c
codingstyle
smartpointers
tr1
如何以 const 形式返回指向指针列表的私有指针?
我有一个指向指针列表的指针 作为私有变量 我还有一个 getter 它返回指向列表的指针 我需要保护它免受更改 我找不到如何使用reinterpret cast 或const cast 对此 class typeA shared ptr
c
constants
smartpointers
privatemembers
containerdatatype
使用shared_ptr的例子?
你好 我今天问了一个关于如何在同一个向量数组中插入不同类型的对象 https stackoverflow com questions 3475030 different types of objects in the same vector
c
boost
vector
sharedptr
smartpointers
unique_ptr 和 OpenSSL 的 STACK_OF(X509)*
我用一些using声明和unique ptr与 OpenSSL 一起使用 如在另一个问题中建议 https stackoverflow com a 38079093 608639 如果没有 代码会变得非常丑陋 而且我不太喜欢 goto 语句
c
C11
openssl
smartpointers
uniqueptr
“由于在生成器中使用而发生移动”错误是什么意思?
我遇到了关于生成器的问题 use tokio runtime Runtime use tokio task JoinHandle use std sync Arc pub fn run f Box
Rust
smartpointers
movesemantics
是否有 C++/CLI 智能指针项目(例如scoped_ptr)?
是否有 C CLI RAII 智能指针类用于在托管类型中包含本机指针 只是想知道 在我自己写之前clr scoped ptr值类模板 我知道微软提供的 本机类中托管句柄的包含 auto gcroot http msdn microsoft
CCLI
smartpointers
是否应该始终使用 boost::ptr_vector 代替 std::vector ?
这只是我遇到的一个概念性问题 在我当前的项目中 感觉我过度使用了 boostsmart ptr and ptr container图书馆 我正在创造boost ptr vectors在许多不同的对象中 并调用 Transfer 方法从一个对
c
boost
vector
smartpointers
即使使用智能指针,C++ 在发生异常时也会泄漏
我是智能指针世界的新手 我已经阅读完毕 他们都指出 即使程序在遇到异常后退出 智能指针也可以避免内存泄漏 我写了一个简单的程序来尝试一下 但是Valgrind http en wikipedia org wiki Valgrind告诉我我的
c
memoryleaks
smartpointers
C++ 多重继承和向上转换的智能指针破坏导致 VS 2017 中的堆损坏
我在使用上面的代码时遇到了 VS 调试器的问题 class Animal public class Stupid public class Dog public Stupid public Animal public int main st
c
inheritance
smartpointers
heapcorruption
如何使用 Arc 和 Weak 创建循环引用?
我有两个结构 struct A map HashMap
reference
Rust
smartpointers
std::make_unique 和 std::unique_ptr 与 new 之间的差异
Does std make unique有任何效率优势 例如std make shared 与手动构建相比std unique ptr std make unique
c
C11
c14
smartpointers
uniqueptr
混合 C++ 和 Objective-C
我使用 C 作为应用程序主干 使用 Objective C 作为 GUI 这很好 但是当谈到在 Objective C mm 文件 中将这些代码混合在一起时 我有几个问题 1 我可以将 STL 容器与 Objective C 或 Cocos
c
Objectivec
boost
cocos2diphone
smartpointers
为什么 Arc::try_unwrap() 会导致恐慌?
我正在编写一个简单的聊天服务器 它向所有连接的客户端广播消息 由于我是初学者 代码可能看起来很糟糕 对等点尚未在任何地方使用 因为我想将其传递给handle client函数也是如此 因此当数据在流中可用并成功读取时 我想在所有连接的客户端
errorhandling
Rust
smartpointers
referencecounting
托管 C++/CLI 类中的 auto_ptr 或 shared_ptr 等效项
在 C CLI 中 您可以在托管类中使用本机类型 因为不允许在托管类中保存本机类的成员 在这种情况下您需要使用指针 这是一个例子 class NativeClass public ref class ManagedClass private
CCLI
smartpointers
autoptr
你能让 std::shared_ptr 管理用 new T[] 分配的数组吗?
你能做一个std shared ptr http en cppreference com w cpp memory shared ptr指向一个数组 例如 std shared ptr
c
C11
sharedptr
smartpointers
将指针容器转换为智能指针?
有没有一种简洁 通用的方法来转换std容器 例如vector 常规 哑指针 vector lt T gt 例如 boost shared ptr vector lt boost shared ptr
c
pointers
boost
STL
smartpointers
原始指针参数的shared_ptr
当函数需要char 时 可以传入shared ptr吗 我正在读取整个文本文件 长度 100 并且想要将字符存储到 char 数组中 我使用的天真的方法是这样的 ifstream dictFile fileName size t fileL
c
function
pointers
smartpointers
“单一分配”对于 boost::make_shared 意味着什么
在boost文档中make shared http www boost org doc libs 1 47 0 libs smart ptr make shared html 它说 除了方便和风格之外 这样的功能还具有异常安全性和显着性 更
c
boost
sharedptr
smartpointers
makeshared
1
2
3
4
5
»