Questions tagged [boost]

17274 questions
1

votes
1

answer
86

Views

Async sending and receiving custom data packets with boost?

I am trying to asynchronously send and receive custom data packets with boost and I have some questions, based on my current implementation: tcpclient.cpp #include 'tcpclient.h' #include #include '../utils/logger.h' tcpclient::tcpclient(std::string host, int port) : _endpoint(boost::asio::ip::addre...
Kyu96
1

votes
2

answer
667

Views

with tuples and boost.fusion, is there any reason to use struct?

tuples are similar to structs (discussed here: Boost::Tuples vs Structs for return values). it seems that the only advantage is it's more convenient to write struct because it's shorter and by key rather than a number. one can also use fusion map and structs to access by key Boost::Tuples vs Structs...
kirill_igum
1

votes
1

answer
76

Views

boost::log 1.66.0. Argument for set_filter from boost's tutorial is wrong

I'm going thru boost::log library tutorial using Boost 1.66.0 and VS 2017. Get the problem in the very beginning: void init() { logging::core::get()->set_filter ( logging::trivial::severity >= logging::trivial::info ); } Error: No operator '>=' matches these operands ... It looks legitimate - Fir...
egor
1

votes
1

answer
54

Views

Shared buffer using boost::intrusive_ptr

I have a use case where one thread reads message into a large buffer and the distributes the processing to a bunch of threads. The buffer is shared by multiple threads after that. Its read-only and when the last thread finishes, the buffer has to be freed. The buffer is allocated from a lock-free sl...
MGH
1

votes
2

answer
281

Views

C++ compilation stuck with boost interprocess lib 'error: `::ftruncate' has not been declared'

This is what I get when I run make : In file included from /usr/include/boost/interprocess/sync/file_lock.hpp:25:0, from init.cpp:61: /usr/include/boost/interprocess/detail/os_file_functions.hpp: In function `bool boost::interprocess::ipcdetail::truncate_file (boost::interprocess::file_handle_t, std...
ZeroGraviti
1

votes
1

answer
212

Views

Boost-geometry : Polygon definition

Could you please tell me why this polygon definition don't work? namespace bg = boost::geometry; int main() { typedef bg::model::point point_type; typedef bg::model::polygon polygon_type; polygon_type P; int xi[] = {0,100,100,0,0}; int yi[] = {0,0,100,100,0}; bg::append(P, bg::make(*xi, *yi)); doubl...
Ella
1

votes
0

answer
84

Views

How to set and keep GPU utilization?

I have a Kepler Nvidia Card and I need to keep the GPU utilization at a certain amount, say 80%, for a certain duration, say 5 seconds. I know that the GPU utilization amount depends on various factors, but here I need to keep CUDA cores busy. Is there any straightforward way to do it?
Ahmad Siavashi
1

votes
1

answer
113

Views

Parse SQL like query with boost spirit x3

I'm trying to parse a simple SQL like query using boost spirit x3. There were a similar post for the previous version of spirit. But With spirit x3, we don't need grammar. So here is my attempt: // SELECT chr, pos FROM table // Select chr, pos FROM table WHERE a=5 and b = 6 // SELECT chr, pos FROM...
DrIDK
1

votes
0

answer
58

Views

Boost graph library - distributed adjacency list

I've been recently trying to implement an algorithm using distributed adjacency lists, as defined in the BGL documentation (http://www.boost.org/doc/libs/1_46_1/libs/graph_parallel/doc/html/distributed_adjacency_list.html) I am constantly seeing this error: error: ‘mpi’ is not a member of ‘boo...
sdgaw erzswer
1

votes
0

answer
344

Views

Problems with Running MySQL Connector in CLion

I've recently installed MySQL Connector for CLion as I am planning to make a program that would MySQL Databases. I've installed the Connector from the mysql website and tried the code that is provided by the website. After running it, I found that it says that boost/shared_ptr.hpp does not exist. So...
Timothy Susanto
1

votes
0

answer
747

Views

How to use boost stacktrace with Visual Studio

I'm using Visual Studio 2015 and I was thinking to use the new boost-stacktrace library in my projects. Therefore I tried the example in the documentation of boost-stacktrace, but seemingly the output wouldn't help me as it should? This is my little test runner program: #include #include #include...
Aleph0
1

votes
0

answer
68

Views

dlopen'd SO's conflict when unloaded

I have two .so files that statically link boost regex. each of those so's are plugins that get dlopen'd by my main executable. It seems that when I unload one of them, it causes out of bound reads in the other so. My theory is that when one so is unloaded, the other one's copy of boost is actually...
mercurytw
1

votes
1

answer
48

Views

How to iterate over all error_info's in boost::exception?

At the catch site of a boost::exception (or std::exception), I want to iterate over all error_info elements of the exception, without knowing the types. I need to extract all the name-value pairs. I guess it should possible since the boost::diagnostic_information function does that, but I'd like to...
Pat
1

votes
1

answer
151

Views

How to replace the base parameter removed from boost::filesystem::weakly_relative and std::filesystem::canonical

The function boost::filesystem::canonical() (doc of 1.66, doc of current release) offers two arguments (ignoring the error code overload) base. The first one is the path to canonicalize, the second argument is the base path used to make the first path absolute if it is relative. By default current_p...
Matthäus Brandl
1

votes
1

answer
63

Views

Trouble Invoking Move Constructor for Deque with Boost Asio Sockets

I'm trying to write a multithreading web server and I'm having a lot of trouble passing accepted boost::asio::ip::tcp::socket objects from my parent thread to my child threads. My current solution is pretty clanky since I don't think i understand proper class oriented design. Still, I want to get th...
Zeke
1

votes
1

answer
74

Views

Shared Object is statically linked against boost program_options; application links shared

I'm working on a library that is statically linking our boost dependencies so that we do not have to worry about conflicting with users. Our library statically links date_time system thread regex filesystem program options We then have an executable that also needs program_options and links against...
Mike K.
1

votes
1

answer
75

Views

Parsing xml using Boost c++ for nested tags

I am trying to parse an xml file using boost which is of the following structure: 1 10 11 2 12 13 I need to store it in the following class: class root_info { public: //some members std::vector chocos; } class choco_info { int color; int companies[100]; } I have written the following code, but it sh...
coder0007
1

votes
1

answer
130

Views

Aliasing boost::variant or std::variant not compilable

Currently my library uses boost::optional and boost::variant. Since C++17 is out, I would like to add an option, that it works with the boost and std. So I tested the complete code with boost optional and variant and std optional and variant successful. So I added a header files that is similar to t...
Felix Petriconi
1

votes
1

answer
322

Views

How to properly unwrap error code from boost exception

The question is simple, yet I cannot figure out how to do it. I want to get the system_error, and from there get the concrete error code. I have something like this in the error: Dynamic exception type: boost::exception_detail::clone_impl std::exception::what: boost::system::system_error I can catch...
Germán Diago
1

votes
1

answer
191

Views

Reading binary file with batch size using boost serialization

I am trying to serialize the class with boost's binary serializer, and loading the binary data with batch size. I am able to fetch the first 5 records out of 10, and the process is crashing while I am trying to read an another 5 records by re-opening the file and re-setting the file read pointer to...
user3620473
1

votes
0

answer
66

Views

How can I detect a break with boost::asio::serial_port?

I have a device which sends serial data in packets. Each packet is separated by a serial break (a low level on the serial line which lasts longer than a character). How can I detect a break using boost::asio::serial_port ? There is a send_break() function, but I could not find information about rece...
rve
1

votes
1

answer
71

Views

Boost related errors while building a C++ project

I'm trying to build a clone of an old game written in C++ (https://sourceforge.net/p/open-chicken-invaders/code/HEAD/tree/trunk/) but I get some Boost related errors that I can't solve. I tried building this project on Windows, Ubuntu and Raspberry Pi but I get the same errors everytime. The develop...
devlime26
1

votes
0

answer
112

Views

Boost.X3: does not compile with std::optional<std::string>

The following parser does not compile when I use std::optional for values of a -lexeme[+alpha] rule: something breaks in the attribute management. The grammar works fine if instead of std::string I use int as a base type, it also works if I use twice std::string (i.e., no std::optional). However it...
akim
1

votes
1

answer
54

Views

Boost.X3: char_ >> char_ discards the characters and behaves like lit

I would like to parse strings with escaping rules similar to that of C. I want to keep the escapes, not decode them and recode afterwards. So I thought that *(char_('\\') >> char_ | char_ - ''') would do what I want, but it does not: it behaves as if I had written lit('\\') to discard that guy. #d...
akim
1

votes
1

answer
40

Views

boost::program_options parse command line always with empty value

On debian stretch, and gcc 6.4.0, boost 1.66.0 boost::program_options parse command line always with empty value. The code below: #include #include #include #include #include int main(int argc, char* argv[]) { using namespace boost::program_options; options_description desc{'Options'}; desc.add...
Panda
1

votes
1

answer
288

Views

Boost.Asio asynchronous server. Limit to one connection

I'm fairly new to Boost.Asio and I want to develop an asynchronous server that limits the number of active connections to one. In other words, when a connection is established, additional connections will be denied. Once that connection is closed, another one can take its spot. It's not immediatel...
Ricardo Angeli
1

votes
0

answer
167

Views

Boost Python Embedding Error

I've just built Boost Python on Windows 10 with an Anaconda version of Python 3.5 (64 bit). I used these instructions modified to my suit my installation and have successfully built the testCode.cpp using Visual Studio 2015: #include using namespace boost::python; int main() { try { Py_...
GoFaster
1

votes
1

answer
47

Views

about using boost::geometry::model::polygon with std::list as a container

I tried the sample code from Boost webpage it works fine - calculates the area of polygon. The documentation for polygon class tells us that it is possible to use different container for vertices: vector (the default), list and deque. So, I decided to use the std::list container. But compiler (Visua...
chopin
1

votes
0

answer
271

Views

Cannot deploy the precompiled header (.gch)

Could you, please, help me with warning: pch.hpp.gch: not used because '__STDC_IEC_559__' not defined emerging when I am trying to deploy a gcc-generated precompiled header with boost headers? Here is my toy model. File pch.hpp: #include #include #include #include and its complementary pch.cpp #...
Oleksii Rudenko
1

votes
1

answer
378

Views

undefined symbols when loading C++ shared lib within a shared C++ lib, which itself is loaded by python

I have been working on a piece of new code within ESPResSo++ (http://www.espresso-pp.de/), a molecular dynamic (MD) simulation package. The code connects ESPResSo++ with PLUMED (https://plumed.github.io/), a plugin for MD packages. ESPResSo++ has extensive uses of boost-python library. The Python co...
B. Song
-1

votes
1

answer
791

Views

How do I use Boost Random [closed]

I need to generate random number with Boost Random. I tried to follow the general guide. I extracted the files of the library. So if I want to use the classes and objectj of the library how I should do? First I know including the library in the program. Then I have to compile the library and the p...
Andrea Angeletti
1

votes
1

answer
126

Views

C++ Boost signals and slots connection

I am trying to connect a gui to my logic thread using boosts signals and slots, the logic class has a neat method to connect functions to the signal. Here is a simplified replica of the locig class: #include #include typedef boost::signals2::signal some_signal; typedef some_signal::slot_type some_...
Arnoud van Leeuwen
1

votes
1

answer
288

Views

HTTP Pipelining vs. WebSocket in Boost.Beast advanced server example

I have a question to this Boost.Beast example: https://github.com/boostorg/beast/blob/908f84cb3c023ed7c5bd19e2e5283d3218a6d820/example/advanced/server/advanced_server.cpp In line 643 a WebSocket upgrade is done. However, if I understand it correctly, there may still be HTTP write commands in the que...
Benjamin Buch
1

votes
0

answer
201

Views

(CMAKE) Compile 32 bit on 64 bit system (error adding symbols: File in wrong format)

I have a cpp project which uses a 32 bit library. When i build and run the app i get this error: dlopen:./lib.so: wrong ELF class: ELFCLASS32 Thats why i'm trying to build this project 32 bit. Here is my cmakeList.txt: cmake_minimum_required(VERSION 3.9) project(app) set(CMAKE_CXX_STANDARD 11) add_e...
Marijke Buurlage
1

votes
1

answer
805

Views

Install A Specific Version of Boost With Homebrew on Mac

I am trying to install an older version of Boost on my Mac using Homebrew. I am using: brew install [email protected] And receiving error: Error: No available formula with the name '[email protected]' I have performed: brew search boost And I can see that I have all versions back to 1.55 installed. Is there a wa...
Alan Carr
1

votes
0

answer
86

Views

How to use boost optional in an API without exposing all of boost

I would like to return a boost::optional from a method on a library API I am writing. I would like to have a nice migration to std::optional later on. Is there a clean way to wrap it without exposing all of boost through my API. (I don't want my users to be locked to my boost version) How can I wrap...
JeffV
1

votes
1

answer
52

Views

Skip intermediate classes in hierarchy inheritance with boost::serialization

Context: I have a tree-like structure representing a AST of Expr that I want to serialize using boost::serialization. The main issue is that all classes have non default constructors and const children. To overcome this issue, I followed the doc and overloaded load_construct_data and save_construct...
Davidbrcz
1

votes
1

answer
43

Views

vector of boost::function not working with _placeholder

I need your help. I tried a lot to find a solution for the problem but failed so far. Idea: Create a vector of 'command tuples' like the following: typedef boost::tuple command_tuple; std::vector commands { boost::make_tuple('command1', boost::bind(&myclass::command1, this)) }; If the string 'comman...
drtyhlpr
1

votes
0

answer
264

Views

How to cross-compile vsomeip for android. boost filesystem error

I'm doing cross-compile vsomeip for android. But, I have fatal error to boost library. I already to boost for android. It doesn't have error. But, In vsomeip for android, I have boost error. [ 61%] Linking CXX executable vsomeipd ../libvsomeip.so.2.0.1: error: undefined reference to 'boost::filesy...
director
1

votes
1

answer
416

Views

Boost Filesystem exists Access violation

I have a Problem with boost::filesystem::exists(pathName). When the folder did not exists the method returns false as expected. If the Folder exists it throws an exception in the make_permissions(const path& p, DWORD attr) Method of the Boost File operations.cpp. This is the code from that file if...
Kevin

View additional questions