boost

SWIG and Boost::variant

不打扰是莪最后的温柔 提交于 2021-02-08 17:44:09
问题 I'm in the middle of trying to wrap a c++ project into a python api using SWIG and I'm running into an issue with code that has the following format. class A { //constructors and such. }; class B { //constructors and such. }; class C { //constructors and such. }; typedef boost::variant<A,B,C> VariantType; typedef std::vector<boost::variant<A,B,C>> VariantTypeList; Classes A,B & C all come out in the python wrapper without a problem and seem to be usable. However when I try to add the

SWIG and Boost::variant

南楼画角 提交于 2021-02-08 17:42:00
问题 I'm in the middle of trying to wrap a c++ project into a python api using SWIG and I'm running into an issue with code that has the following format. class A { //constructors and such. }; class B { //constructors and such. }; class C { //constructors and such. }; typedef boost::variant<A,B,C> VariantType; typedef std::vector<boost::variant<A,B,C>> VariantTypeList; Classes A,B & C all come out in the python wrapper without a problem and seem to be usable. However when I try to add the

SWIG and Boost::variant

家住魔仙堡 提交于 2021-02-08 17:38:47
问题 I'm in the middle of trying to wrap a c++ project into a python api using SWIG and I'm running into an issue with code that has the following format. class A { //constructors and such. }; class B { //constructors and such. }; class C { //constructors and such. }; typedef boost::variant<A,B,C> VariantType; typedef std::vector<boost::variant<A,B,C>> VariantTypeList; Classes A,B & C all come out in the python wrapper without a problem and seem to be usable. However when I try to add the

Create a compile time key-to-type map which is filled by calls to a variadic function

懵懂的女人 提交于 2021-02-08 11:20:44
问题 Is it possible to create a key->type map at compile time, with each key-value being added when an instance of a variadic function is called? template <typename T, typename ... Args> void writeToQueue(Args... args) { //Do something with args. // Insert to map. something akin to: // CODEMAP[T] = Args... // T -> Args... mapped when foo<T,Args...> is called. } Or template <int code, typename ... Args> void writeToQueue(Args... args) { //Do something with args. // Insert to map. something akin to:

Using boost::asio::deadline_timer inside a thread

这一生的挚爱 提交于 2021-02-08 10:42:28
问题 I used boost::asio::deadline_timer to run a function. I have MosquitoInterface class as follow class MosquitoInterface{ MosquitoInterface(deadline_timer &timer) : t(timer){} } Inside my main.c int main(int argc, char** argv ) { io_service io; deadline_timer t(io); MosquitoInterface *m = new MosquitoInterface(t); io.run(); d = new Detectdirection(); while(run) { int ret = d->Tracking(); if(ret < 0) cout << "Pattern is not found" << endl ; } if(d!=NULL) delete d; if(m!=NULL) delete m; cout <<

TypeError: __init__() should return None, not 'NoneType' with Python Boost

假如想象 提交于 2021-02-08 09:53:41
问题 cmake file cmake_minimum_required(VERSION 3.13) project(p1) set(CMAKE_CXX_STANDARD 11) FIND_PACKAGE(PythonInterp) if (PYTHONINTERP_FOUND) if (UNIX AND NOT APPLE) if (PYTHON_VERSION_MAJOR EQUAL 3) FIND_PACKAGE(Boost COMPONENTS python${PYTHON_VERSION_SUFFIX}) FIND_PACKAGE(PythonInterp 3) FIND_PACKAGE(PythonLibs 3 REQUIRED) else() FIND_PACKAGE(Boost COMPONENTS python) FIND_PACKAGE(PythonInterp) FIND_PACKAGE(PythonLibs REQUIRED) endif() else() if (PYTHON_VERSION_MAJOR EQUAL 3) FIND_PACKAGE(Boost

Customizing the full error message for expectation failures (boost::spirit::x3)

旧时模样 提交于 2021-02-08 09:38:06
问题 The boost::spirit::x3 error handling utilities allow for the user to choose what is shown to the user when an expectation failure occurs. This, however, does not seem to be the case for the line number portion of the message, which is exactly what I'd like to modify. So instead of it printing out In line 1: etc. I would like to print some other message in it's place with the same line number info. Anyone know how I could do that, or if it is even modifiable in the first place? EDIT: Here's

C++ Boost::serialization : How do I archive an object in one program and restore it in another?

白昼怎懂夜的黑 提交于 2021-02-08 09:15:24
问题 I'm using Boost Serialization for saving and loading my game's overall state as well as storing map and creature data externally. I have two programs. The first runs the game itself, creating new objects as necessary based on the data saved in the external files. It also produces savefiles of its own state. These all work so far. The second, I am creating as a dedicated editor. I want to use it to create and manipulate said files to be used by the game program. So I made mirror images in the

Memory function of the boost::gil library

六眼飞鱼酱① 提交于 2021-02-08 07:26:22
问题 I am currently trying to make some TensorFlow Inference (C backend) using Boost::GIL (challenging). I need a few thinks, I have been able to load my png image ( rgb8_image_t ) and did a conversion to rgb32_f_image_t . I still need 3 thinks, the raw pointer of the data, memory allocated, and dimensions. for the memory allocated unfortunately the function total_allocated_size_in_bytes() is private, so I did this: boost::gil::view(dest).size() * boost::gil::view(dest).num_channels() * sizeof

What is boost system error_code number 2

杀马特。学长 韩版系。学妹 提交于 2021-02-08 06:48:51
问题 I am trying to figure out what boost system error code 2 is. Within a program they print out the boost error code. However, I am not sure how to look up this error code. Any help would be apprecaited. 回答1: Off the top of my head: ENOENT/FileNotFound See the errorcodes in http://www.boost.org/doc/libs/1_58_0/libs/system/doc/reference.html#Header-error_code Live On Coliru #include <boost/system/error_code.hpp> #include <iostream> int main() { boost::system::error_code ec; ec.assign(2, boost: