boost

Efficient method of passing callback member function

元气小坏坏 提交于 2021-02-07 18:03:20
问题 I'm designing a method for an input handler class. Here is some pseudo code... void InputHandler::ScanEvents( boost::function1< void, std::string& > &func ) { // Scan keys, determining string to pass // If string found, call func with string as its argument on object tied to func } I'm not exactly sure how to implement this, or if it is even possible, since the whole point of a function is to separate it from its caller. The idea is that an object has a private member function and a boost:

Efficient method of passing callback member function

蓝咒 提交于 2021-02-07 18:01:33
问题 I'm designing a method for an input handler class. Here is some pseudo code... void InputHandler::ScanEvents( boost::function1< void, std::string& > &func ) { // Scan keys, determining string to pass // If string found, call func with string as its argument on object tied to func } I'm not exactly sure how to implement this, or if it is even possible, since the whole point of a function is to separate it from its caller. The idea is that an object has a private member function and a boost:

Cmake FindBoost.cmake MinGW-W64: searching for library with incorrect name

狂风中的少年 提交于 2021-02-07 17:30:45
问题 I have built Boost 1.68 (using instructions from https://gist.github.com/sim642/29caef3cc8afaa273ce6, and adding link=static,shared to the b2 command line to also build shared libraries.) The libraries appear to build correctly, and I have set the BOOST_INCLUDEDIR and BOOST_LIBRARYDIR environment variables correctly. However, when I add the following to a CMakeLists.txt : find_package(Boost REQUIRED COMPONENTS system context coroutine thread random REQUIRED) and generate with MinGW Makefiles

Cmake FindBoost.cmake MinGW-W64: searching for library with incorrect name

房东的猫 提交于 2021-02-07 17:29:02
问题 I have built Boost 1.68 (using instructions from https://gist.github.com/sim642/29caef3cc8afaa273ce6, and adding link=static,shared to the b2 command line to also build shared libraries.) The libraries appear to build correctly, and I have set the BOOST_INCLUDEDIR and BOOST_LIBRARYDIR environment variables correctly. However, when I add the following to a CMakeLists.txt : find_package(Boost REQUIRED COMPONENTS system context coroutine thread random REQUIRED) and generate with MinGW Makefiles

How to build Boost::program_options

回眸只為那壹抹淺笑 提交于 2021-02-07 13:29:40
问题 I wanted to use boost::program_options. After I installed boost, I think that I have to build separatly program_options (http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html). But I don't know how to do it. I am trying to compile the C:\Program Files\boost\boost_1_42\libs\program_options\example\first.cpp (http://www.boost.org/doc/libs/1_42_0/doc/html/program_options/tutorial.html) but probably due to I didn't build the library I have this error: LINK : fatal error LNK1104:

How to build Boost::program_options

随声附和 提交于 2021-02-07 13:29:15
问题 I wanted to use boost::program_options. After I installed boost, I think that I have to build separatly program_options (http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html). But I don't know how to do it. I am trying to compile the C:\Program Files\boost\boost_1_42\libs\program_options\example\first.cpp (http://www.boost.org/doc/libs/1_42_0/doc/html/program_options/tutorial.html) but probably due to I didn't build the library I have this error: LINK : fatal error LNK1104:

How to build Boost::program_options

帅比萌擦擦* 提交于 2021-02-07 13:26:58
问题 I wanted to use boost::program_options. After I installed boost, I think that I have to build separatly program_options (http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html). But I don't know how to do it. I am trying to compile the C:\Program Files\boost\boost_1_42\libs\program_options\example\first.cpp (http://www.boost.org/doc/libs/1_42_0/doc/html/program_options/tutorial.html) but probably due to I didn't build the library I have this error: LINK : fatal error LNK1104:

Minimal boost.org includes to use just one sub-library

吃可爱长大的小学妹 提交于 2021-02-07 13:18:36
问题 I'd like to use the boost smart_ptr library. I don't want any of the other libraries because I'm trying to keep my project small. When I added just the smart_ptr library I got complaints that the config.hpp header couldn't be found. I added that file then my compiler said it couldn't find the assert.hpp header. I gave up after that and just included the entire boost library. Is there a minimal set of boost libraries that must be used if I want to use one of the sub-libraries (e.g., smart_ptr

boost python: tie lifetime of argument to returned value using return_internal_reference

梦想的初衷 提交于 2021-02-07 09:19:09
问题 I begin learning to use boost python and have a rookie question. I would like to write a function that can tie the lifetime of its argument to its results, such that when I call r = func(a) , the argument a will never be destroyed if I still have a reference of r . The documentation suggests using return_internal_reference call policy for this type of request. But does this require r to be an internal reference of a , as the name suggested? In the (over-simplified) example below, suppose I

boost python: tie lifetime of argument to returned value using return_internal_reference

前提是你 提交于 2021-02-07 09:17:10
问题 I begin learning to use boost python and have a rookie question. I would like to write a function that can tie the lifetime of its argument to its results, such that when I call r = func(a) , the argument a will never be destroyed if I still have a reference of r . The documentation suggests using return_internal_reference call policy for this type of request. But does this require r to be an internal reference of a , as the name suggested? In the (over-simplified) example below, suppose I