草庐IT

boost-locale

全部标签

c++ - 为什么可以使用额外参数调用 Boost.Bind 函数?

#include#include#includevoidfoo(std::stringconst&dummy){std::cout运行时,它会打印出“Yo:platypus”。它似乎完全忽略了额外的参数。我希望得到一个编译错误。我不小心以这种方式在我的代码中引入了错误。 最佳答案 我不知道为什么允许这样做,但我知道这是预期的行为。来自here:bindcanhandlefunctionswithmorethantwoarguments,anditsargumentsubstitutionmechanismismoregeneral:

c++ - 我的程序泄漏了 boost::shared_ptr 拥有的资源

我看不出为什么我的程序会泄漏,也许你能发现它。typedefboost::shared_ptrStringPtr;typedefstd::pairWMapPair;typedefstd::mapWindowMap;//thiscallbackpopulatestheWindowMap(m_Windows)byaddingaWMapPaireachtimeBOOLCALLBACKEnumWindowsCallback(HWNDhWnd){//addsthiswindowtotheWindowMap,alongwithitstitletextBOOLbRetVal=FALSE;intnTe

c++ - BOOST_FOREACH 对 boost::shared_ptr<list> 的迭代

我正在做与此项目类似的事情CorrectBOOST_FOREACHusage?但是,我返回的列表包含在boost::shared_ptr中。如果我没有在BOOST_FOREACH循环之前将列表分配给变量,我会在运行时崩溃,因为列表正在被破坏,因为它是临时的。boost::shared_ptr>GetList(){boost::shared_ptr>myList(newlist());myList->push_back(3);myList->push_back(4);returnmyList;}然后……//WorksifIcommentoutthenextlineanditerateov

c++ - 将 Boost FileSystem3 迭代器转换为 const char*

我正在使用BoostFileSystem3循环遍历目录中的一些文件,我需要将文件名转换为char*以用于另一个库,不幸的是我的C++foo缺失,任何人都可以帮忙吗?intmain(intargc,char*argv[]){pathp(argv[1]);//preadsclearerthanargv[1]inthefollowingcodetry{if(exists(p))//doespactuallyexist?{if(is_regular_file(p))//isparegularfile?coutvec;//storepaths,vecv;//sowecansortthemlate

c++ - boost::asio::async_write() 与 boost::asio::write()

在将数据缓冲区传输到线路上所花费的时间方面是否有任何优势如果你使用boost::asio::write(m_socket,asio::buffer(dataOut_,len),asio::transfer_all());代替boost::asio::async_write(m_socket,boost::asio::buffer(hbs,sizeof(hbs)),boost::bind(&Client::handle_pulse,this,boost::asio::placeholders::error,boost::asio::placeholders::bytes_transfer

Linux 硬件时间(RTC time)、系统时间(UTC时间、Universal time)、本地时间(Local time)、时区(Time zone)与夏令时(DST)解析

文章目录理解时间:硬件时间、系统时间(UTC时间)、本地时间、时区与夏令时1.硬件时间(RTCtime)1.1硬件时间简介1.2如何使用硬件时间2.系统时间(UTC时间)(Universaltime)2.1系统时间简介2.2UTC时间3.本地时间(Localtime)3.1本地时间简介3.2如何使用本地时间4.时区(Timezone)4.1时区简介4.2如何设置时区4.3docker容器中的时区(与宿主机日期时间同步)5.夏令时(DaylightSavingTime)(DST)5.1夏令时简介5.2夏令时地区采用夏令时的地区不采用夏令时的地区:5.3如何处理夏令时6.ubuntutimedat

c++ - Boost.Log 无法设置日志过滤器(未声明的标识符 'severity')

我正在努力让Boost.Log进入我的项目。问题出在这个简单示例的以下行中:usingnamespaceboost::log;core::get()->set_filter(trivial::severity>=trivial::info);在我的代码中,这转化为以下内容:boost::log::core::get()->set_filter(boost::log::trivial::severity>=boost::log::trivial::info);但是,我收到以下错误:errorC2039:'severity':isnotamemberof'boost::log::v2s_m

c++ - 当 -std=c++11 选项被删除时,clang++ 仅使用 boost::format 编译 C++11 程序

请看下面的C++11片段:#includeintmain(intargc,char**argv){autos=boost::format("");return0;}当我使用-std=c++11用clang编译它时,我得到以下错误:$clang++-std=c++11-omainmain.cppInfileincludedfrommain.cpp:1:Infileincludedfrom/usr/include/boost/format.hpp:19:Infileincludedfrom/usr/include/boost/detail/workaround.hpp:41:Infilei

c++ - 有没有更好的方法来检查是否存在 boost 共享内存段?

我能看到如何做到这一点的唯一方法是尝试访问它并捕获如果它不存在则抛出的异常。boolexists(){usingnamespaceboost::interprocess;try{managed_shared_memorysegment(open_only,kSharedMemorySegmentName);returnsegment.check_sanity();}catch(conststd::exception&ex){std::cout有没有更好的办法? 最佳答案 我在玩boost::interprocess时碰巧问了同样的问

c++ - 如何等待所有 boost 完成 :asio's stackful coroutines?

我正在用asio::spawn启动一些协程,我想等到所有协程都完成后再做一些其他工作。如何实现?控制流程如下:asio::spawn(io,[](asio::yield_contextyield){...//startingfewcoroutinesasio::spawn(yield,[](asio::yield_contextyield2){...});asio::spawn(yield,[](asio::yield_contextyield2){...});asio::spawn(yield,[](asio::yield_contextyield2){...});asio::spa