草庐IT

atomic_shared_ptr

全部标签

c++ - 使用 Boost Python & std::shared_ptr

我正在尝试让BoostPython与std::shared_ptr很好地配合使用。目前,我收到此错误:Traceback(mostrecentcalllast):File"test.py",line13,incomp.place_annotation(circle.centre())TypeError:Noto_python(by-value)converterfoundforC++type:std::shared_ptr来自调用circle.centre(),它返回一个std::shared_ptr。我可以将每个std::shared_ptr更改为boost::shared_ptr(

c++ - 使用 Boost Python & std::shared_ptr

我正在尝试让BoostPython与std::shared_ptr很好地配合使用。目前,我收到此错误:Traceback(mostrecentcalllast):File"test.py",line13,incomp.place_annotation(circle.centre())TypeError:Noto_python(by-value)converterfoundforC++type:std::shared_ptr来自调用circle.centre(),它返回一个std::shared_ptr。我可以将每个std::shared_ptr更改为boost::shared_ptr(

c++ - unique_ptr、pimpl/forward 声明和完整定义

我已经查看了问题here和here,但仍然无法找出问题所在。这是调用代码:#include"lib.h"usingnamespacelib;intmain(constintargc,constchar*argv[]){return0;}这是库代码:#ifndeflib_h#definelib_h#include#include#includenamespacelib{classFoo_impl;classFoo{public:Foo();~Foo();private:Foo(constFoo&);Foo&operator=(constFoo&);std::unique_ptrm_imp

c++ - unique_ptr、pimpl/forward 声明和完整定义

我已经查看了问题here和here,但仍然无法找出问题所在。这是调用代码:#include"lib.h"usingnamespacelib;intmain(constintargc,constchar*argv[]){return0;}这是库代码:#ifndeflib_h#definelib_h#include#include#includenamespacelib{classFoo_impl;classFoo{public:Foo();~Foo();private:Foo(constFoo&);Foo&operator=(constFoo&);std::unique_ptrm_imp

c++ - 为 iPhone 应用程序解析 RSS/Atom 提要的最佳方法是什么?

所以我知道,就直接解析XML而言,有几个选项可用:NSXMLParser、TouchCode中的TouchXML等。这一切都很好,而且对我来说似乎工作得很好。这里真正的问题是RSS提要(以及Atom提要)有许多小的变化,因此支持Internet上所有可能的提要排列变得非常难以管理。我四处寻找可以为我处理所有这些低级细节的库,但结果却一无所获。既然可以链接到Objective-C中的外部C/C++库,我想知道是否有一个库最适合这项任务?一定有人已经创建了这样的东西,只是很难从Google的数千个结果中找到“正确”的选项。无论如何,在iPhone应用程序中解析RSS/Atom提要的最佳方法

c++ - 为 iPhone 应用程序解析 RSS/Atom 提要的最佳方法是什么?

所以我知道,就直接解析XML而言,有几个选项可用:NSXMLParser、TouchCode中的TouchXML等。这一切都很好,而且对我来说似乎工作得很好。这里真正的问题是RSS提要(以及Atom提要)有许多小的变化,因此支持Internet上所有可能的提要排列变得非常难以管理。我四处寻找可以为我处理所有这些低级细节的库,但结果却一无所获。既然可以链接到Objective-C中的外部C/C++库,我想知道是否有一个库最适合这项任务?一定有人已经创建了这样的东西,只是很难从Google的数千个结果中找到“正确”的选项。无论如何,在iPhone应用程序中解析RSS/Atom提要的最佳方法

c++ - boost shared_lock。阅读首选?

我正在查看boost库(1.45版)的读/写锁。当我对其进行测试时,似乎shared_ptr更喜欢我的阅读器线程,即当我的编写器尝试为其操作获取锁时,它并没有阻止任何后续读取的发生。是否有可能在boost中改变这种行为?usingnamespacestd;usingnamespaceboost;mutexoutLock;shared_mutexworkerAccess;boolshouldIWork=true;classWorkerKiller{public:voidoperator()(){upgrade_locklock(workerAccess);upgrade_to_uniqu

c++ - boost shared_lock。阅读首选?

我正在查看boost库(1.45版)的读/写锁。当我对其进行测试时,似乎shared_ptr更喜欢我的阅读器线程,即当我的编写器尝试为其操作获取锁时,它并没有阻止任何后续读取的发生。是否有可能在boost中改变这种行为?usingnamespacestd;usingnamespaceboost;mutexoutLock;shared_mutexworkerAccess;boolshouldIWork=true;classWorkerKiller{public:voidoperator()(){upgrade_locklock(workerAccess);upgrade_to_uniqu

c++ - 关于weak_ptr的线程安全

std::shared_ptrg_s=std::make_shared(1);voidf1(){std::shared_ptrl_s1=g_s;//readg_s}voidf2(){std::shared_ptrl_s2=std::make_shared(3);std::threadth(f1);th.detach();g_s=l_s2;//writeg_s}关于上面的代码,我知道读取和写入相同shared_ptr的不同线程会导致竞争条件。但是weak_ptr呢?下面的代码中是否有任何竞争条件?(我的平台是微软VS2013。)std::weak_ptrg_w;voidf3(){std:

c++ - 关于weak_ptr的线程安全

std::shared_ptrg_s=std::make_shared(1);voidf1(){std::shared_ptrl_s1=g_s;//readg_s}voidf2(){std::shared_ptrl_s2=std::make_shared(3);std::threadth(f1);th.detach();g_s=l_s2;//writeg_s}关于上面的代码,我知道读取和写入相同shared_ptr的不同线程会导致竞争条件。但是weak_ptr呢?下面的代码中是否有任何竞争条件?(我的平台是微软VS2013。)std::weak_ptrg_w;voidf3(){std: