草庐IT

boost-test

全部标签

c++ - 使用 boost 时出现问题,无法打开共享对象文件

所以我正在尝试编译并运行一个简单的boost计时器程序#include#include#includeintmain(){usingnamespaceboost::asio;io_serviceio;deadline_timert(io,boost::posix_time::seconds(5));t.wait();std::cout编译这个程序时我尝试做的第一件事是g++-I/home/vagrant/boost_1_60_0main.cpp这给了我一个错误/tmp/cc8Ytqko.o:Infunction`__static_initialization_and_destructi

c++ - boost库中的以下定义是什么意思

我正在研究内部的boost库,对以下定义感到困惑:namespaceboost{namespacecontainer{template,typenameA=std::allocator>classbasic_string;templatebasic_stringbasic_string&&operator+(basic_stringbasic_string&&mx,constbasic_string&y);类型的含义是什么basic_stringbasic_string&&mx?这与longlongint相似吗?类型?这是boost引用链接:boost1.48.0

c++ - Boost Graph Library : How to use depth_first_visit, ColorMap 问题

初始问题:BoostGraphLibrary:PreventDFSfromvisitingunconnectednodes我正在尝试使用boost::depth_first_visit,但不知道如何提供ColorMap属性。我在这里尝试了示例中给出的方法:http://www.boost.org/doc/libs/1_58_0/libs/graph/example/loops_dfs.cpp我的(相关)代码:///Definevertexproperties.structNodeProperty{unsignedid;///Id.unsignedkind;///Kind.unsigne

python - boost::python 可以将对象的所有权传递给 python 回调函数吗?

我目前正在使用boost::python::call将C++指针传递给python回调函数功能。这工作正常,但如果我随后不删除C++代码中的指针,就会引入内存泄漏。我想将指针传递给回调并让python的垃圾收集器处理对象的生命周期。现在,如果我想保存传递给回调的对象,我必须进行深拷贝。我看过here使用return_value_policy包装的C++函数的返回值可能会发生这种情况.是否可以对boost::python::call的参数做类似的事情?? 最佳答案 方式manage_new_object工作原理是作为一个元函数类,将参

c++ - 使用boost线程的多线程中的段错误(核心转储)

当尝试使用最多1个线程运行我的程序时,它可以正常工作一段时间(几秒或几分钟)但最终出现段错误(核心转储)或双重释放(faststop)错误。这里是线程运行的函数。//usedintheFunction[Added]typedeffolly::ProducerConsumerQueuePcapTask;structs_EntryItem{Columns*p_packet;//hassomearbitrarymethodandvariablesboost::mutex_mtx;};//_buffersConnection.wait_and_pop()Datawait_and_pop(){b

c++ - 如何在 Google Test 中为一个夹具运行多个测试用例?

假设我有一个名为ProfileTest的GoogleTestfixture继承自::testing::TestWithParams创建一个解析器:classProfileTest:public::testing::TestWithParam>{public:QStringgetName(){returnQFileInfo(*m_file).fileName();}protected:voidSetUp(){m_profile=newProfile();m_file=newQFile(std::get(GetParam()).c_str());m_file->open(QIODevice

c# - 为什么 if( !A && !B ) 不能优化为单个 TEST 指令?

if(!A&&!B)似乎应该编译为moveax,dwordptr[esp+A_offset]testeax,dwordptr[esp+B_offset]jne~~~~~~~~~~编译器实际生成moveax,dwordptr[esp+A_offset]testeax,eaxjne~~~~~~~~~~moveax,dwordptr[esp+B_offset]testeax,eaxjne~~~~~~~~~~看这里转储8B45F8moveax,dwordptr[b]837DFC00cmpdwordptr[a],07504jnemain+32h(0A71072h)85C0testeax,eax7

c++ - 使用来自 Boost.Spirit 的 Lex 和 Qi 在语法规则中使用词法分析器标记属性

让我们考虑以下代码:#include#include#include#include#include#include#include#includenamespacelex=boost::spirit::lex;namespaceqi=boost::spirit::qi;namespacephoenix=boost::phoenix;structoperation{enumtype{add,sub,mul,div};};templateclassexpression_lexer:publiclex::lexer{public:typedeflex::token_defoperator_

c++ - 如何在等待时取消 `boost::asio::read` 操作

我正在使用boost::asio在客户端和服务器之间来回传输数据。我在客户端有一个读取器线程来读取客户端套接字上接收到的数据。请注意,我在客户端使用boost::asio::read,在服务器端使用boost::asio::write。不使用async_read或async_write。一切都很好。但是,当我关闭我的应用程序时,10次中有2次该应用程序没有完全关闭或正确关闭。关闭时挂起问题如下:我的关闭函数在我的应用程序关闭期间调用析构函数时被调用。以下是关闭函数的代码:socket.cancel();socket.close();boost::system::error_codeec

c++ - 如何从 boost 属性树中读取字段类型

我正在使用boost属性树从json文件中读取值。{"some_values":{"field_1":"value_1","field_2":true}}我可以读取值:spTree->get("some_values.field_1","");spTree->get("some_values.field_2",false);但是我可以读取存储在任何给定字段中的变量类型吗? 最佳答案 Documentationsays[...]thefollowingJSON/propertytreemappingisused:[...]JSONva