草庐IT

boost-pool

全部标签

c++ - 为什么 boost::any 禁止转发 const&&?

相关代码如下://PerfectforwardingofValueTypetemplateany(ValueType&&value,typenameboost::disable_if>::type*=0//disableifvaluehastype`any&`,typenameboost::disable_if>::type*=0)//disableifvaluehastype`constValueType&&`:content(newholder::type>(static_cast(value))){}据我所知,可以使用复制构造函数从const&&构造。我使用boost1.55.0

c++ - 为什么要使用 std::mutex 而不是 boost::shared_mutex?

我的理解是:std::mutex会阻塞其他线程,无论它们是想读还是写,而boost::shared_mutex将允许多次读取。所以我的问题是,我是否应该总是更喜欢boost::shared_mutex而不是普通的std::mutex以允许并行读取的可能性?使用普通的std::mutex感觉就像我在否认一些可能的读取吞吐量......? 最佳答案 我不能说出它们两者之间的性能,但我的猜测是,由于额外的逻辑,boost::shared_mutex可能会更慢。除此之外,根据您拥有的读者数量,您可能会阻塞写入线程的时间比您希望的要长,因为它

c++ - Boost::graph Dijkstra 和自定义对象和属性

我想使用boost的dijkstra算法(因为我在程序的其他部分使用了boost)。我遇到的问题是将自定义对象(我相信它们被称为property)添加到adjacency_list。本质上,我有一个自定义边类,它维护有关边和通过它连接的顶点的各种信息。我想用adjaceny_list所需的边缘属性存储我的自定义数据对象我已经成功实现了boostprovides的玩具示例.我尝试使用自定义属性无济于事(boostexample,boostproperties)。我可以将我的VEdge数据结构封装在结构或其他东西中,我只需要能够检索它。但是我一直无法弄清楚如何将我的自定义数据结构包含到bo

c++ - boost::read_graphviz - 如何读出属性?

我正在尝试从GraphvizDOT文件中读取图表。我对Vertex的两个属性感兴趣——它的id和peripheries。A还想加载图形标签。我的代码是这样的:structDotVertex{std::stringname;intperipheries;};structDotEdge{std::stringlabel;};typedefboost::adjacency_listgraph_t;graph_tgraphviz;boost::dynamic_propertiesdp;dp.property("node_id",boost::get(&DotVertex::name,graph

c++ - 使用 boost 几何检查两条线是否有交点

是否可以使用boost::geometry来检查两条线段(每条线段由2D中的两个点给出)是否相互相交?如果这是可能的,boost::geometry是否也允许检查特殊情况,例如另一条线上只有一个点(数字上),或者两条线相等? 最佳答案 如果您专门谈论Boost.GeometryAPI,那当然是可能的。你的代码应该大致如下所示#include#includetypedefboost::geometry::model::segmentSegment;SegmentAB(Point(x1,y1),Point(x2,y2));Segment

c++ - boost 日志 : Support file name and line number

我试图让我的团队远离log4cxx并尝试使用Boost.Logv2。我们目前的log4cxxpattern很简单:log4cxx::helpers::Propertiesprop;prop.setProperty("log4j.rootLogger","DEBUG,A1");prop.setProperty("log4j.appender.A1","org.apache.log4j.ConsoleAppender");prop.setProperty("log4j.appender.A1.layout","org.apache.log4j.PatternLayout");prop.se

c++ - 使用 boost::asio::streambuf 的代码导致段错误

我在使用asio::streambuf时遇到过问题,希望有人能告诉我我是否错误地使用了该类。当我运行此示例代码时,它会出现段错误。为什么?让事情变得更加困惑的是,这段代码适用于Windows(VisualStudio2008),但不适用于Linux(使用gcc4.4.1)。#includeusingnamespacestd;intmain(){boost::asio::streambufStream;//Put4bytesintothestreambuf...intSetValue=0xaabbccdd;Stream.sputn(reinterpret_cast(&SetValue),

c++ - Boost Spirit Qi Custom Syntesized Attribute(通过语义操作设置结构属性的特定成员)

假设我有一个我想用灵气解析成的结构,它是这样定义的:structdata_{boolexport;std::wstringname;data_():export(false){}};此外,假设结构已适应这样的融合:BOOST_FUSION_ADAPT_STRUCT(data_,(bool,export)(std::wstring,name))关联的规则是:qi::rule>rule_data;rule_data=-lexeme["SpecialText">>!(alnum|'_')][boost::phoenix::at_c=true]//Ifthisstringisfound,,se

c++ - boost::filesystem::path::native() 返回 std::basic_string<wchar_t> 而不是 std::basic_string<char>

尽管以下代码可以在Linux上编译,但我无法在Windows上编译它:boost::filesystem::pathdefaultSaveFilePath(base_directory);defaultSaveFilePath=defaultSaveFilePath/"defaultfile.name";conststd::strings=defaultSaveFilePath.native();returnsave(s);其中base_directory是一个类的属性,它的类型是std::string,而函数save只需要一个conststd::string&作为参数。编译器提示第三

iphone - iOS5 ARC 应用程序 : __NSAutoreleaseNoPool(): of class NSCFNumber autoreleased with no pool in place - just leaking

我最近为我的应用程序项目切换到ARC。我正在使用iOS5SDK。运行一台iPod4g设备我没有收到任何警告。但是尝试在iPod2g上运行我的应用程序时,我收到了很多警告:***__NSAutoreleaseNoPool():Object0x258070ofclassDataModelautoreleasedwithnopoolinplace-justleaking***__NSAutoreleaseNoPool():Object0x2530a0ofclass__NSArrayMautoreleasedwithnopoolinplace-justleaking***__NSAutorel