boost

boost::bind composition inside io_service::post function

五迷三道 提交于 2020-01-15 03:58:41
问题 Given the following class class task_counter { public: task_counter(short, boost::asio::io_service&); ~task_counter(void); template<typename CompletionHandler> void exec_task(CompletionHandler handler) { grant_access(); io_.post(boost::bind(&task_counter::exec_and_decrease_counter<CompletionHandler>, this, handler)); } template<typename CompletionHandler> void exec_and_decrease_counter(CompletionHandler handler) { handler(); decrease_counter(); } private: .... } Method exec_task is called by

LNK1104: cannot open file 'boost_thread-vc100-mt-gd-1_55.lib'

痞子三分冷 提交于 2020-01-15 02:40:08
问题 I'm facing difficulty to build qpid cpp solution on windows xp I have installed Boost 1.55.0, Python 2.7, Ruby 2.0.0 and CMake 2.8 Then I have added Environment variable paths for Python, Ruby and CMake, and then Boost variables are set as followed BOOST_ROOT C:\Boost BOOST_LIBRARYDIR C:\Boost\lib BOOST_INCLUDEDIR C:\Boost\include I build Boost with following commands from command prompt bootstrap .\b2 I have downloaded qpid-cpp-0.26, Then I build qpid with following command from command

How to cast `std::chrono::milliseconds` to `boost::posix_time::milliseconds`

天涯浪子 提交于 2020-01-14 19:21:06
问题 I am using a boost::asio::deadline_timer like so to set some timeout before an async_read operation on a tcp socket . I am using boost 1.61 . long time_out_millis = 2000; boost::asio::deadline_timer theTimer(theSocket.get_io_service(), boost::posix_time::milliseconds(time_out_millis)); Problem: Other parts of my code use std::chrono::milliseconds . I want use std::chrono instead of the "long time_out_millis" & if possible use std::chrono::milliseconds instead of boost::posix_time:

Error: forming pointer to reference type 'const std::pair<double, unsigned int>&'… I can't understand this error

大兔子大兔子 提交于 2020-01-14 15:00:11
问题 I'm getting some errors when trying to use -> in an iterator type. When I dig in the library defining the iterator, it seems to me that everyhing is allright and that there is no reason for the error. Here is the code, part of boost::multi_array: template <class T> struct operator_arrow_proxy { operator_arrow_proxy(T const& px) : value_(px) {} T* operator->() const { return &value_; } // This function is needed for MWCW and BCC, which won't call operator-> // again automatically per 13.3.1.2

Using boost condition variables

情到浓时终转凉″ 提交于 2020-01-14 14:46:28
问题 I am designing an asynchronous logger class as follows. However, not sure if I am using the boost condition variable in the right way. Can anyone comment on this? Here the processLogEntry method is a thread function and I am using boost here. void LogWriter::stopThread() { mStop = true; mCond.notify_one(); mThread->join(); } void LogWriter::processLogEntry() { while(!mStop) { boost::mutex::scoped_lock lock(mMutex); mCond.wait(lock); while(!q.empty()) { // process begins } } } void LogWriter:

Boost linking error: 'B5cxx11' symbols missing

元气小坏坏 提交于 2020-01-14 13:57:48
问题 Here's the issue: the code I'm using uses a big library which links against boost. When I compile with static linking, everything works fine. However, when I try dynamic linking I get a bunch of undefined reference errors. The first thought was obviously "I am not linking the boost program_options" library, but I looked, and it is there in the linking command (and it comes after the library that needs it). Among the different errors, though, this stood out: undefined reference to `

VC++ stack trace does not resolve function names on production

瘦欲@ 提交于 2020-01-14 12:35:11
问题 I recently implemented stack trace logging using boost's new stacktrace library: int debugErrorCallback(int status, const char* func_name, const char* err_msg, const char* file_name, int line, void* userdata) { boost::stacktrace::stacktrace stacktrace(4, 10); //skipped 4 frames include cv::error, this function and 2 in boost::stacktrace ctor std::cout << boost::stacktrace::detail::to_string(stacktrace.as_vector().data(), stacktrace.size()) << std::endl; } Having tested it on my development

how to subtract one path from another?

╄→尐↘猪︶ㄣ 提交于 2020-01-14 10:43:29
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it

how to subtract one path from another?

折月煮酒 提交于 2020-01-14 10:43:08
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it

how to subtract one path from another?

时光毁灭记忆、已成空白 提交于 2020-01-14 10:43:06
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it