All Questions
1,739 questions
1
vote
1
answer
64
views
Any better way to improve the code to keep the underlying memory blocks used by aiso::async_send remains valid
I once wrote the the code snippet below to asynchronously send tcp data.
void Conversation::do_write(std::string str)
{
auto conversation_ptr(shared_from_this());
m_socket.async_send(asio::buffer(...
1
vote
1
answer
98
views
Suitable use of 'boost::asio::placeholders::error'
The code snippet below is seen at this page.
#include <iostream>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
using ...
0
votes
0
answers
73
views
How to use boost log in visual studio 2015 and build platform is v140
I have added all the dependencies but after adding it i am getting some linking error. I am using visual studio 2015 buildtool v140 , platform v8.1 and platform win32.
I have added the necessary ...
0
votes
1
answer
32
views
Boost Python C++ boost::python::list input Python argument types did not match C++ signature
Created a test function to test if Boost Python can pass a Python list to a C++ method. However, it results in the following error:
Boost.Python.ArgumentError: Python argument types in boost_cpp....
1
vote
2
answers
89
views
boost pp repeat to forward declare classes
In short, I would like to accomplish the following:
#define CLASS( C ) class C;
#define CLASSES( ... )
CLASSES( Foo, Bar, Golf ) // Expand: class Foo; class Bar; class Golf;
Is there any way to ...
1
vote
2
answers
617
views
Understanding Boost.Asio Strand Behavior with Multiple Threads
Win12, boost::asio 1.82.0, MSVC 2022 (I used different compilers, c++ 14 and c++ 20)
I try to understand iocontext step by step.
Now I want to use many threads (but I don't want to use thread pool yet,...
0
votes
1
answer
169
views
Replace boost::timed_wait() with std in c++17
I have a condition variable std::condition_variable my_cond;
I want to be able to replace boost::timed_wait() with an std equivalent one.
If the previously mentioned condition variable was a boost one,...
1
vote
1
answer
584
views
Convert from boost time to std::chrono for C++11
I would like to replace some boost time lines with std::chrono.
*boost::posix_time::ptime myTime( boost::gregorian::date(1960, 1, 1))
As far as I know, Gregorian time is available on C++20. So is ...
1
vote
1
answer
58
views
boost coroutine doesn't resume after an async_write operation
I have a simple boost.coroutine that occasionally is suspended? and i don't know what happens with the coroutine. It's hard to reproduce but does happen.
Now, from this answer (point.2) i know that a ...
1
vote
1
answer
49
views
C++ VSCode Ubuntu Terminal intercepting command line responses
I have a program in Linux C++ in VSCode that I am trying to debug. I am using Boost process::ipstream to send a command line command like "ip -a", then try to use std::getLine() to read the ...
1
vote
0
answers
238
views
Catching a Diamond Of Death Exception (boost::system::system_error and std::system_error)
I have a library, and I wish to leverage the design of boost::system::system_error. C++ adopted this design in 2011 with std::system_error. I would like for client code to have the option of working ...
0
votes
1
answer
287
views
Install C++ json boost on RHEL machine
I am trying to install json boost (boost_json) library on my linux RHEL machine.
I got the latest tar file from boost.org i.e. boost_1_83_0.tar.gz. After untaring the file I ran the following commands....
1
vote
1
answer
55
views
How to do deep copy of graph property wrapped in std::shared_ptr<> in boost graph?
I have a boost graph with custom properties.
I want to make a copy of it. I tried it by following way.
using BGType = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
...
0
votes
1
answer
49
views
boost.test: compile errors when STL code is included within a test suite
My setup:
windows 10
msys2 with
g++ 12.2.0
boost.test 1.81.0
My test file:
// test.cpp
#define BOOST_TEST_MAIN
#define BOOST_TEST_MODULE a_nice_testing_attempt
#include <boost/test/included/...
1
vote
1
answer
565
views
boost::to_lower_copy() too expensive as it extracts a facet from the passed locale
I've got std::use_facet<std::ctype<char>> showing up in a profiler. It is called indirectly from boost::to_lower_copy().
I remember fixing this for a comparison operator by storing the ...
2
votes
0
answers
272
views
How can I compile and generate libraries of boost version 1.82.0 in Aix?
Compiling the boost C++ library 1.82.0 on AIX 7.2 using xlclang++
I am trying to build the b2 binary using xlclang++ but getting std errors
class.cpp:
warning: unknown warning option '-WL' [-Wunknown-...
1
vote
1
answer
507
views
Bind boost::asio socket to new port
I haven’t yet successfully found a way to change the port of a boost asio udp socket at run time, after the initialization. Is this possible or would I have to close the socket and re-open with a ...
2
votes
1
answer
169
views
How to optimize boost heaps to outperform std multiset in heap operations? C++
I have worked on implementing the fast marching method. It's a computational method to solve a special type of differential equation. In particular, this code solves the equation $$|\nabla phi| = 1$$ ...
1
vote
1
answer
92
views
Resolving symlinks of a file path using boost c++11
I am trying to resolve any symlinks present in a file path even if the symlink is occurred to the parent directory of a file.
So if for example I have a/b/d/file and a symlink is created for dir b ...
0
votes
1
answer
516
views
How to fix undefined symbols for arm64 when using boost::filesystem on m1 macbook?
I'm trying to work with file paths in c++11. The overwhelming advice on the internet is to use the boost library where I should be able to do something like this.
I installed boost(version 1.81.0_1) ...
0
votes
1
answer
415
views
Passing a function as function argument in Boost.Python
I have a C++ function ExecuteFunction that takes as input another function f.
I would like to expose ExecuteFunction in Python with Boost.Python, and call it from Python with either Python functions ...
1
vote
1
answer
132
views
Boost Serialization: Serialize/Export derived class without default constructor
I need to serialize all the options on my CommunicationLayer, which is basically a wrapper around serial port, which I will use in an initialization file of sorts.
This class doesn't have a default ...
2
votes
2
answers
462
views
cannot compile standalone asio with exceptions turned off
I'm trying to build project which uses standalone asio as dependency. Problem is that with exceptions turned off (-fno-exceptions), I have to define throw_exception function (link to boost ...
0
votes
0
answers
536
views
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am getting a linking error with my two C++ files as seen below.
Compile error
It compiles up to the point of two object files then fails on linking.
Below is my code, I commented out most of main in ...
0
votes
1
answer
98
views
How to use the function `pj_geodetic_to_geocentric` in boost library?
In boost/geometry/srs/projections/impl/pj_transform.hpp, I found two functions pj_geodetic_to_geocentric and pj_geocentric_to_geodetic, the function declarations are below:
template <typename T, ...
1
vote
1
answer
31
views
array of boost dynamic_bitset. If arr[0][0] bit is set, arr[1][0]test() is also set
I have initialized array of dynamic bitset as follows
std::vector<boost::dynamic_bitset<>> v
= std::vector<boost::dynamic_bitset<>>(8, boost::dynamic_bitset<>(2));
...
2
votes
1
answer
459
views
Sharing std::string among the processes using Boost::Interprocess
I am following this Boost::Interprocess guide . I have structure which has std::string as member and I have created multimap of that structure with std::string as key values.
I can access std::string ...
0
votes
0
answers
19
views
undefined reference to `boost::filesystem...` with self-compiled boost [duplicate]
I'm trying to compile a c++ program with boost library that I compiled myself.
Here is how I compiled boost in ~/libs/
tar -xvzf boost_1_80_0.tar.gz
cd boost_1_80_0/
./bootstrap.sh --prefix=.
./b2 -...
1
vote
1
answer
239
views
How can I use boost accumulator quantile_probability inside a class member initialization?
Boost Accumulator has an unfortunate quirk in which the api interface behaves differently when used inside of a class.
I am trying to use Boost Accumulator quantile_probability inside of a class but I ...
3
votes
1
answer
367
views
Create boost::spsc queue in boost managed shared memory with a runtime size
Shared-memory IPC synchronization (lock-free)
My use case aligns very closely with what has been described in the above question. But I wanted to go a step further in creating the spsc queue ...
3
votes
0
answers
310
views
How can I build the boost libraries 1_72_0 on a windows host for a linux target?
Trying to build the boost libraries, I followed the steps:
open cmd in boost_1_72_0 folder
bootstrap.bat gcc
set cfalgs, cxxflags and linker flags to use the sysroot folder that came with the ...
2
votes
1
answer
344
views
format string is not a string literal in a variadic template function (C++)
I have this simple function, in which I get an error:
format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
I know that I can make a C-style variadic function and ...
0
votes
1
answer
399
views
Build boost from source with manually built gcc compiler in cluster
I am trying to compile Boost 1.79.0 in a cluster using the GCC compiler version 12.1.0 that I have compiled manually since the GCC version of the cluster is very old.
After compiling GCC, I have ...
-3
votes
1
answer
230
views
How to pass std::index_sequence param to an nested-template struct according to function traits
Here is my simple code and it did work (I passed single integer to argument):
#include <iostream>
#include <tuple>
#include <string>
#include "boost/variant.hpp"
using ...
3
votes
2
answers
604
views
Double free or corruption when using asio
I made some modifications to this code snippet which is used to send\recieve ICMP packets through ASIO APIs.
Here are the modifications that I made(full code snippet is seen below):
using the ...
1
vote
1
answer
439
views
Boost Asio Timeout Approach
I have situation where I need to collect data from more than 100 clients in 100 ms. After that time I need to process collected data. When process is done, need to restart step where I am collecting ...
0
votes
0
answers
160
views
Android C++ network module with boost asio (ssl), infinite loop
I am using boost 1.70.0 in android native for network module.
The AsioClient is singleton for accept http request from all instances(Image, Video, HTML, JS source URI and so on).
And this is not on ...
0
votes
1
answer
2k
views
"TBB library cannot be found" CMake on MacOS
I'm trying to build PrusaSlicer from source on Mac. I don't have any experience with CMake. I'm following the instructions given here.
Every time I try to build dependencies. This command cmake .....
1
vote
2
answers
895
views
openssl/conf.h file not found error on MacOS
When trying to compile code (using cmake), I keep getting this error :
In file included from /usr/local/include/cpprest/http_client.h:68:
In file included from /usr/local/include/boost/asio/ssl.hpp:18:...
1
vote
1
answer
2k
views
BOOST request sending JSON data
I want to transfer json data into request of json boost in cpp.
If i take json in boost
int outer=2;
value data = {
{"dia",outer},
{"sleep_time_in_s",0.1}
};
...
1
vote
1
answer
368
views
How to iterate over boost graph and find neighbor's neighbor also?
The following figure shows bi-directional graph. I have represented following graph using boost-graph.
I have iterated from v1 --> v2 and v1 --> v3 but I am not able to visit from v3 --> v4....
1
vote
1
answer
65
views
Cleanly exit Boost thread member of class
I have a class that has a boost::thread member variable. I have a private member function that is run in that thread (see code below).
class Human
{
public:
Human()
: m_thinkThread(&...
2
votes
1
answer
824
views
How to iterate over boost graph to get incoming and outgoing edges of vertex?
I am trying to iterate over boost graph. While iterating, I am trying to find incoming edges and outgoing edges from that vertex. But I am getting segmentaion fault.
I tried to debug and found the ...
1
vote
1
answer
493
views
can boost::process::system support bash commands separated by a semicolon?
Code:
#include <boost/system/process.hpp>
int main() {
boost::process::system bp("echo foo; echo bar");
}
Output:
foo; echo bar
Desired output:
foo
bar
I am receiving a ...
4
votes
1
answer
3k
views
boost::asio::bind_executor does not execute in strand
The following example completes with no assertions:
#include <cassert>
#include <functional>
#include <future>
#include <thread>
#include <boost/asio.hpp>
class example1
...
1
vote
1
answer
139
views
vk api on boost c++ doesn't work correctly
I wrote a some code that should send GET request and get response.
It works for ip-api.com and returns me json file.
But for api.vk.com it returns html as that:
<html>
<head><title&...
1
vote
1
answer
309
views
how to cast from intrusive_ptr<parent> to intrusive_ptr<child>?
I have to get a child class pointer that is wrapped in boost's intrusive_ptr from intrusive_ptr<parent_class> returned by a class function.
class parent{...}
class child: public parent{...}
...
0
votes
1
answer
446
views
Trouble building Boost Log example using Bazel
I am using Bazel as my build system and have had no problems with Boost up until I started trying to use Boost Log, I was even able to use some of the compiled libraries without issue however when ...
0
votes
0
answers
99
views
Boost Serialization Library in MEX
I am trying to convert my MEX/MATLAB/C++ program into solely C++. And the first big step is getting rid of saving files as mat file. I am saving various structs so from my understanding serialization ...
1
vote
2
answers
606
views
Boost transformed conversion to vector error
I am new to using boost adapters, I am using the following code for conversion of a vector one class to transformed version.
The return type of boost::transformed is not as per expectation. Can ...