28,103 questions
Advice
1
vote
5
replies
57
views
Solving an equation containing a singularity in Boost odeint
When converting a differential equation (DQ) to a system of first-order DQs, if the term in the original DQ with the highest derivative has a variable coefficient, dividing by that coefficient may ...
1
vote
0
answers
88
views
Using boost::asio::async_wait with Native recvfrom() Calls: Is It Correct?
Suppose we are waiting for incoming data on a socket using the call socket::async_wait(socket::wait_read, callback). After the callback notifies us that data is available, is it possible to read the ...
2
votes
1
answer
143
views
Is it possible to apply rate limiting to UDP sockets in Boost?
As is well known, in Boost we can use a rate limit to restrict the read and write speed of a TCP stream, as indicated in the documentation: https://www.boost.org/doc/libs/latest/libs/beast/doc/html/...
0
votes
2
answers
209
views
Boost.Unordered unordered_flat_map: why does it need sentinel?
I've been going through Boost's unordered_flat_map implementation. Here's an overview:
https://www.boost.org/doc/libs/latest/libs/unordered/doc/html/unordered/structures.html#...
1
vote
1
answer
96
views
How to get boost::process to invoke docker from anywhere?
Boost version 1.74
Docker version 28.2.2
A toy program works when invoked from its build directory:
$ cd build
$ ./test
27610c1a6b49a0f459fc9e39a374f2e5b9b5e3175b0e926af4c7359c6bd7f93f
but when ...
1
vote
0
answers
122
views
Number of threads for domain name resolution in boost asio
According to the boost::asio documentation, for each io_context one or more additional threads can be created that will be used for host resolution.
One or more additional threads per io_context to ...
1
vote
1
answer
161
views
What is the source of difference in size of statically built and dynamically built libraries in the boost library
On installing boost library (of which boost graph library is a part), the following has been installed on my computer:
(1) C:\local\boost_1_86_0\boost\graph\header files.hpp
(2) C:\local\boost_1_86_0\...
0
votes
1
answer
68
views
Cmake 4.1 Can't Find boost_headers-config.cmake
I'm using cmake 4.1 with boost 1.88.0. I set BOOST_ROOT to C:\boost_1_88_0
The problem happens because cmake finds BoostConfig.cmake in C:\boost_1_88_0\tools\cmake\config, which calls find_package() ...
3
votes
1
answer
179
views
Boost multiarray, how to declare a class member and populate it at run time
I am attempting to move away from std::vector<std::vector<int>> types and use boost::multi_array in its place. I am struggling how to initialize such data members though.
I used to have a ...
2
votes
1
answer
102
views
Boost.Beast async_connect fails after upgrading Boost 1.78 to 1.89
I have a Websocket class that connects asynchronously using Boost.Asio and Boost.Beast. The following code was working fine with Boost 1.78, but after updating to the latest Boost version, I now get a ...
2
votes
1
answer
202
views
LNK1104: cannot open file 'libboost_program_options-vc143-mt-s-x64-1_89.lib'
Actually No files ending with "vc143-mt-s-x64-1_89.lib" exist in my Boost library, but still compiler tried to find 'libboost_program_options-vc143-mt-s-x64-1_89.lib'. I don't know why.
Here ...
4
votes
1
answer
143
views
Boost Asio Timer interruption after signal is handled
I have the following program that just runs a timer for 5 seconds and has a signal handler.
#include <boost/asio.hpp>
#include <chrono>
#include <iostream>
#include <signal.h>
...
2
votes
2
answers
97
views
Hook asio io_context so that my own functor is called for every completion handler
I am working in a system which uses a global Clock singleton to store the current time.
class Clock
{
public:
static Clock& instance()
{
static Clock clock;
return clock;
...
0
votes
1
answer
118
views
How do I find Boost date_time in CMake by using vcpkg?
I have vcpkg 2025-09-03 installed and CMake 4.1.2 installed.
Now I want to install Boost Date-Time
.\vcpkg.exe install boost-date-time
And check if boost-date-time is installed.
PS C:\Users\negrå\...
2
votes
1
answer
73
views
Mongodb v6.0.16 boost error when building from source with scons: run_it<FutureExecutorContinuationSharedState>' has no member named 'that'
I'm trying to build an older version of Mongod on Arch Linux.
It's required by software called Deadline that I intend to use; Deadline's documentation says the following: "For maximum ...
4
votes
1
answer
122
views
missing-field-initializers warning for 3rd party dependency base class
I am getting a warning (turned into an error with -Werror) about missing-field-initializers when using designated initializers for the fields in my struct, because I'm not initializing fields in a 3rd ...
-1
votes
0
answers
36
views
Can't build a sample app with boost::cobalt [duplicate]
I wrote a sample console app that uses boost::cobalt with the following code in CMake:
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
set(Boost_USE_STATIC_LIBS ON)
set(...
2
votes
1
answer
125
views
When does socket::is_open return false?
Suppose I accept a socket by calling async_accept like this
acceptor.async_accept([](const boost::system::error_code& ec, boost::asio::ip::tcp::socket sock)
{
if (ec)
return;
auto sess = std:...
1
vote
1
answer
130
views
BOOST_DATA_TEST_CASE with dataset = list of tuples
My data-driven Boost test-case takes several parameters. I chose to group them in a std::tuple. So the resulting dataset consists in a list of tuples.
Beyond a 1-element tuple (test1 below), the ...
-1
votes
0
answers
43
views
boost, like parallel_group but runtime determined number of tasks [duplicate]
I have some courtine tasks that return an asio::awaitable<...> - possibly different types (but yes, I know what they supposed to return).
I want to run them in parallel and wait for all of them ...
0
votes
0
answers
47
views
Failing to configure nghttp2-asio in MacOS
I checked out nghttp2/asio in my C++ project. I have built boost version 1.89.0 from source using b2.
I am met with error "Could not find version of library" and as per the configure shell ...
0
votes
0
answers
105
views
building boost with b2 on windows msys2 ucrt64 clang produces windows/visual c++ style binaries rather than posix style ones
I'm trying to build boost on windows (currently windows 10 because my pc sadly doesn't have the tpm) with clang from msys2/mingw64/ucrt. To be clear, I have these infos from my current clang:
clang++ -...
1
vote
1
answer
50
views
In Boost's b2 build system, how do I AND-combine multiple conditions for a conditional property
In a Boost b2 Jamfile.v2, I have a lib for which I want to define <optimization>off and <cxxflags>-O1, but only for release builds using Clang on macOS (so <target-os>darwin AND <...
0
votes
0
answers
231
views
How to use boost::asio::co_spawn with boost::thread::future?
I'm trying to use asio::co_spawn with boost::future in Thread library, such that I could chain the co_routine task with then() function. But the problem is asio::use_future only generates std::future. ...
0
votes
0
answers
106
views
VS2022 17.6+Boost.ASIO 1.89+C++20: there are no parameter packs available to expand
I encountered a compiler bug when using C++20 + Boost.ASIO in Windows boost1.89 & msvc17.6:
asio\co_composed.hpp(162,33): error C3546: '...': there are no parameter packs available to expand
asio\...
2
votes
1
answer
197
views
How to parse multipart/form-data from http::request<http::string_body> object?
I am reading a http::request<http::string_body> request from the network using boost::beast, which is of type multipart/form-data. The request contains files and strings.
How can I get each part ...
0
votes
0
answers
57
views
SIGSEGV in boost::stacktrace::frame::source_line when accessing thread_local storage on macOS 15 Clang 17 intel; Boost bug or Clang bug or macOS bug?
We have a C++20 library that compiles several Boost modules and statically links their object files into our shared library. One of those modules is Boost.Stacktrace. We compile this library, and a ...
4
votes
2
answers
526
views
Converting pointer-to-member to member index using Boost.PFR without creating an object
Consider the following struct:
struct Particle
{
float scale;
float opacity;
float rotation;
};
I want the following to compile:
static_assert(indexOf<&Particle::scale>() == 0);
...
5
votes
2
answers
132
views
Copy boost::asio::streambuf using std::ostream
I need to copy one boost::asio::streambuf to another. For this I decided to use std::ostream. At the moment I copy the buffer like this
boost::asio::streambuf src;
boost::asio::streambuf dst;
std::...
7
votes
2
answers
183
views
How to convert std::chrono::system_clock::now() to boost::mysql::datetime::time_point
I'm using the boost mysql library in a project. I need to use boost::mysql::datetime (datetime) to represent timestamps. A datetime value can be constructed from a boost::mysql::datetime::time_point.
...
3
votes
1
answer
104
views
Why prepare_payload removes Transfer-Encoding: chunked from http::response?
I create http::response<string_body> and call prepare_payload() after the response is built like this
http::response<http::string_body> res;
res.version(11);
res.result(http::status::ok);
...
0
votes
1
answer
52
views
Compiling boost for use with mex on Windows 11
I can't compile the boost library on Windows 11, specifically serialization which is not header-only, for use with mex in MATLAB. I am compiling boost with .\bootstrap.bat; .\b2.exe link=static ...
1
vote
1
answer
81
views
Serializing and compressing std::map using Boost [closed]
I'm trying to serialize and compress a std::map using Boost. Here's the serialization code:
#include <boost/archive/binary_oarchive.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#...
3
votes
1
answer
153
views
Call boost::asio::post for io_context which runs in another thread
I have two threads and I need to run a task from the first thread but in such a way that the task is executed in the second thread.
For this I decided to use boost::asio::post, but I'm not sure if it ...
2
votes
1
answer
192
views
boost.asio : how to cancel a synchronous task
The following code simulates short bursts of work by sleeping 1ms at a time in order to achieve a cancellable task that takes a total of 2s. That work is then launched in three different ways.
The ...
3
votes
1
answer
99
views
Is it correct to reset the connection in websocket::stream_base::decorator callback?
I have a websocket server where I call websocket::stream::async_accept to perform a handshake with the client.
I also set a decorator to modify the headers like this
conn->get_websocket_stream()....
-1
votes
1
answer
145
views
How to determine whether the ClientHello message was received fully or not [closed]
I read TLS ClientHello data from the network using boost::asio like this
socket->async_wait(ip::tcp::socket::wait_read, [=](const boost::system::error_code& ec)
{
std::size_t avail = socket-...
4
votes
1
answer
65
views
Does http::response_parser inherits limits from source parser?
I create http::response_parser<http::buffer_body> and set header_limit and body_limit like this
auto parser = std::make_shared<http::response_parser<http::buffer_body>>();
parser->...
3
votes
1
answer
161
views
Will moving ssl::context cause UB?
I have some code that creates an ssl::stream. The ssl::stream object takes an ssl::context in its constructor by reference. Creating an ssl::stream looks like this
ssl::context ssl_context(boost::asio:...
1
vote
1
answer
130
views
ssl::stream::shutdown sometimes does not complete
I want to close the TLS connection gracefully. So before closing the socket I call ssl::stream::shutdown. I call ssl::stream::shutdown in the session destructor and at that moment I have no active ...
3
votes
1
answer
152
views
Is it guaranteed to cancel socket operations under Windows 10+?
Suppose we have ip::tcp::socket and asynchronous operations, and at some point we call ip::tcp::socket::cancel. Is it guaranteed that all asynchronous operations will be cancelled? The documentation ...
1
vote
1
answer
71
views
WebSocket interface binding not working with Boost.Beast - socket still uses default interface
I'm trying to bind a WebSocket connection to a specific network interface using Boost.Beast, but the socket keeps using the default interface instead of the specified one.
I have a WebSocket client ...
2
votes
1
answer
110
views
call ssl::stream::async_shutdown after read operation cancelled
I have one active async operation, it is http::async_read. At the moment when I want to close the ssl connection, I cancel this async operation on the socket by calling ip::tcp::socket::cancel.
Then I ...
3
votes
1
answer
152
views
Correct way to call ssl::stream::async_shutdown
Is it correct to call ssl::stream::async_shutdown while there are outstanding async_read_some/async_write operations? Should I wait for all async operations to complete before calling ssl::stream::...
0
votes
0
answers
112
views
Waf cannot find the Boost libraries on MSYS2?
On a fresh install of MSYS2, I got into problems with a waf install of Ardour, the digital audio workstation, partly following this recipe. My approach was:
Install MSYS2 using the installer from ...
2
votes
1
answer
87
views
compiler errors when trying to use modify function in boost multiindex when looping over a specific iterator?
I have made a boost multiindex of my GameObject, and I am trying to loop through and call non const functions on it. And I cannot for the life of me to get boost to stop giving long nasty compiler ...
2
votes
1
answer
95
views
Controlling BOOST_ASIO_ENABLE_HANDLER_TRACKING Output at Runtime
I'm using the BOOST_ASIO_ENABLE_HANDLER_TRACKING flag in Boost.Asio to enable handler tracking logs, which provides useful debugging output to the standard error stream.
I have a couple of questions ...
2
votes
1
answer
158
views
How do I use boost::catmull_rom for time series interpolation?
I want to implement Catmull-Rom interpolation for a time series of data sampled at irregular intervals. I noticed that Boost provides catmull_rom in its interpolation library, and I have tried to use ...
0
votes
0
answers
99
views
boost::asio::io_context stops running new tasks
I'm encountering an issue with the Boost.Asio library. My program uses a single io_context instance and multiple worker threads that call io_context::run(). Tasks are posted using spawn or post on the ...
1
vote
1
answer
130
views
Why doesn't boost::asio::async_initiate or async_compose automatically call the handler via its bound executor
Code firstly, very simple example code:
template <typename CompletionToken>
decltype(auto) test_initiate(CompletionToken&& token) {
return boost::asio::async_initiate<...