Questions tagged [boost]

Boost is a large collection of high-quality libraries intended for use in C++. Boost is free, and is often considered a "second standard library".

Filter by
Sorted by
Tagged with
4
votes
1answer
63 views

Boost.Asio Server and RAII

I am trying to implement a network server application in C++ using Boost.Asio. Here are the requirements I am trying to meet: The Application creates only one instance of ...
2
votes
1answer
60 views

Async tcp socket client: send multiple requests with one connection

I'm new to socket programming and c++. I have a the following method that sends an array to server and receives sum of the array, I tried to make it async. ...
3
votes
0answers
40 views

Yet another reflection library

Tried to do my own implementation of reflection(introspection) for using in my next projects. Is it optimized at compile time? If no, how can I improve it? This macro is good interface for adapting ...
6
votes
1answer
66 views

Using Boost.Spirit to transform expression to AST

Is there a better way to transform some expression to AST using Boost.Spirit? I have built it, but I think it's messy and can be simplified a lot. Code is also available on Godbolt. ...
3
votes
0answers
58 views

Fibonacci and Lucas sequence generator using Boost and GMP

I implemented this console application that generates Fibonacci and Lucas sequence numbers using boost and GMP for multiprecision. There is an iterator-like class which can do any sequence based on ...
1
vote
1answer
35 views

Implementing boost::upgrade_mutex using only standard locks

Is this my_upgrade_mutex class a valid implementation of boost::upgrade_mutex semantics? (Ignoring the ...
2
votes
0answers
17 views

Using Boost's Runge-Kutta integration capability in a templated mathematical model

This is my first time using Boost and templates in general, so I'm mostly looking for a style critique on my C++. In particular, I'd like feedback on: state_type, ...
2
votes
1answer
285 views

C++ Sorting Filenames In A Directory

I wanted to have some advice about the code I have. I managed to get what I wanted done, but I do not think it is the "proper" way of doing it in the programmers' world. Could you help me improve ...
2
votes
1answer
92 views

“Structure of arrays” wrapper

I was looking into SOA to better utilize SIMD instructions. I implemented a generic wrapper object that lets you chose the amount of individual vectors each structure consists of. I am using xsimd and ...
2
votes
2answers
614 views

Implementation of a class that runs a child process with timeout using boost process in async mode

In the following code, I am trying to implement a program that runs a process and returns its return code, stdout and stderr. It ...
5
votes
2answers
254 views

A Matrix Library in C++;

I have written a Matrix library that contains all the main properties of matrices. It's a relatively long project, I am hoping it is ok to post here since I really want to have it reviewed. The ...
1
vote
0answers
150 views

Implementing boost::asio's async_read_some

I need to implement async_read_some from Boost Asio. The reason is here https://stackoverflow.com/questions/59223064/implementing-behaviour-of-boostasio-for-a-class but I don't think it's relevant. ...
0
votes
0answers
27 views

optimization of using boost graph library in solving system of ODE

I tried to use boost graph library for connection of nodes and used a system of ODE on top of connected nodes. Then I compared the code using a 2 dimensional vector instead of graph. Using 2D vector (...
2
votes
0answers
42 views

program options from command line initialize [v3 - after CR]

After my previous code review, I'm sharing my new code, and asking for better ways (which always exist) to improve the code, even with new libraries. The only thing that important to me, is the way of ...
6
votes
1answer
87 views

program options from command line initialize [v2 - after CR]

After getting a CR from @pacmaninbw and @ALX23z here, I want to share my new code, and to ask for better ways (which always exist) to improve the code, even with new libraries. The only thing that ...
3
votes
2answers
179 views

program options from command line initialize

I'd like to receive a CR for the following command-line program options' initializing using boost::program_options. I'd like to know if there is a better way of ...
10
votes
3answers
18k views

Filter out elements from std::vector

I have ended up with the following code in order to filter out some bad elements from a std::vector: ...
3
votes
1answer
168 views

Producer consumer with threads and using boost ring buffer

I have two threads, one is the producer and other is consumer. My consumer is always late (due to some costly function call, simulated in below code using sleeps) so I have used ring buffer as I can ...
7
votes
1answer
244 views

Parallel Ramanujan's formula for 1/π calculation

I finished my university project for calculating \$1/\pi\$ and I would love to get some feedback. Before you guys jump into this code please keep in mind newcomer to C++ just decided to use it for ...
5
votes
1answer
549 views

C++ observer pattern via boost.signals2

I was looking for a thread safe implementation of the observer pattern. I read https://xinhuang.github.io/posts/2015-02-11-how-a-multi-threaded-implementation-of-the-observer-pattern-can-fail.html and ...
23
votes
1answer
17k views

UDP Network server/client for gaming using boost.asio

I've designed those classes for use in a multiplayer game with possibly very high number of clients for one server. Is this implementation good, or is there something obvious I overlooked or something ...
3
votes
1answer
70 views

A matrix-vector multiply parallelized using boost::MPI

This program performs a matrix-vector multiply using MPI to split the computation up. It is not extremely robust (for example, it doesn't handle the case where the number of MPI processes does not ...
3
votes
1answer
97 views

Using boost::mpi to take the Euclidean norm of a vector

I am learning MPI (via boost::mpi) and wrote this program that takes the euclidean norm of a 1-D vector (represented as an array here.) I want to make sure that I ...
3
votes
0answers
168 views

Calculate huge Fibonacci Numbers in C++ using GMP and boost::multiprecision

Problem Statement Calculate the exact value of the n-th Fibonacci number, say the one-billionth. Algorithm The algorithm is based on the idea that Fibonacci numbers can be represented as 2x2 ...
4
votes
1answer
195 views

Automatic Differentiation with C++ Header-Only Library

Code review/feedback is requested and appreciated for the following open-source automatic differentiation C++ header-only library released under the Boost License. I am the author. https://github.com/...
1
vote
1answer
360 views

C++ game server

I'm writing a server for an MMO game using boost::asio. I would like to know, are there any design or other issues in my code? And what should I improve in it? Thanks in advance. BaseServer.h: ...
2
votes
1answer
126 views

Operator overloading for Boost interval (vectors)

I am a complete newbie to C++ and programming in general. I need to write something for scientific purposes and as such, performance is crucial. I introduced two types, matrices and vectors with ...
2
votes
3answers
3k views

Calculate the crc32 of the contents of a file using boost

I'm computing the crc32 of a given file using boost: ...
0
votes
1answer
191 views

Use of a single member struct as an attribute with boost::spirit::karma generators

Original Problem The original problem is parsing/generation of the transport header of the RTSP protocol, see RFC 2326 12.39 Transport, Page 60. The transport header is defined of multiple transport ...
9
votes
1answer
909 views

Simple parsing for string formatting (version 2)

This is my second attempt (version 1) at writing a string formatting utility which uses parsing. This time I more explicitly designed it as a finite state machine. I have very little experience with ...
-1
votes
1answer
82 views

How to use a predicate to create or filter vector [closed]

I have function which returns a vector or strings (values from an sqlite3 table). For each of those strings I need to generate a Qt Checkbox, if it does not exist yet. My first version looks like ...
13
votes
5answers
4k views

Processing XYZ data from a large file

I'm new to programming (1.5 years experience at university), and I'm working on my first computer vision related project! My goal is to take a file which might have CSV (comma separated) or txt format ...
1
vote
0answers
67 views

Determining if a regex can be found in a string

I've written my first C++ multithreaded application (as far as I can recall) which determines if a regex can be found in a string. This code works correct to the best of my knowledge. Could you gals/...
3
votes
0answers
80 views

C++ Trie implementation with Python wrapper

I'm just starting to use C++ so beginner feedback is fine here. CPP code (main.cpp, node.h, node.cpp, trie.h, trie.cpp, utils.h) main.cpp ...
0
votes
1answer
150 views

Traverse directory and store data

During one of assignment, I need to directory and store into proper data structure. I did following way and create to store as tree with multiple child and child will have linked list. Any ...
2
votes
2answers
77 views

Storing and loading functions

The class Functions can store/load any functions. It does this by assigning a unique name to every function that gets added. You can then call the function by ...
11
votes
1answer
150 views

Pattern for writing a generic string transformation function

I often need to write string processing functions that take an input string and transform that into some output string. I'm looking for a pattern to make such functions as generic as possible (with ...
6
votes
2answers
252 views

Compile-time Lagrange polynomials in C++

I have implemented Lagrange polynomials, i.e. \$l_j(x) := \prod_{\begin{smallmatrix}0\le m\le k\\ m\neq j\end{smallmatrix}}\frac{x-x_m}{x_j-x_m} = \frac{(x-x_0)}{(x_j-x_0)} \cdots \frac{(x-x_{j-1})}{(...
3
votes
0answers
386 views

C++17: Boost.Hana based compile-time plugin registration

My aim with the following is to have a way of registering a list of classes, which represent plugins. In the end, I want a boost::hana::set that contains type objects for all plugins' classes. I want ...
12
votes
4answers
3k views

FizzBuzz, ’17-style

My exercise is to write the Fizz Buzz problem with the following in mind: Use the latest up-to-date style and best practices for a C++17 compiler. Don’t just show that I can write a loop. Rather, ...
5
votes
0answers
546 views

Quasi-Random Number Generators

I would like to communicate a piece of code which I hope will soon be broadly useful for everyone who programs in C++: A set of quasi-random number generators proposed for addition to boost.random. To ...
7
votes
2answers
133 views

Class template for the encapsulation of datasheet specifications using optionals

A couple of years ago I wrote a pair of class templates to encapsulate specifications which have one or more of a minimum, typical, and/or maximum value, e.g. on a datasheet like this one for the 741 ...
1
vote
0answers
3k views

Best practices to pass pcl::PointCloud<PointT> to a function

I am trying to pass a point cloud to a function. Since the point cloud data is huge, I don't want the compiler to make a copy of it while passing. Hence I passed the reference of it as shown below- <...
1
vote
0answers
42 views

Box partitioning with arrays of boost::intervals

I need to write a function that takes a box in space, represented as an std::vector of boost::intervals, and split it into several smaller boxes. First, for convenience, I made some definitions <...
3
votes
0answers
270 views

Define a class for latitude and longitude in C++ using boost::units and spheroidal coordinates

I am trying to write a class that defines latitude and longitude in C++ using boost::units and normalized spheroidal coordinates. I want to throw an exception if ...
3
votes
0answers
145 views

Recursive directory scan using boost file system

I have written the following code for searching and recursive directory. Please review it. Can it be optimized to avoid traversing symlink and handle "abort" signal inside for loop to continue the ...
7
votes
1answer
149 views

Computing max t such that tanh(pi*sinh(t)/2) <1

I'm looking for a way to quickly determine that maximum value of t such that tanh(pi/2 sinh(t)) is strictly less than 1, for a ...
3
votes
3answers
2k views

SCOPE_EXIT implementation

I'm a fanboy of the Boost library and I've used Boost's components extensively in my C++03 project. The team decided to merge several pieces of code including my project. I will get the C++14 ...
5
votes
2answers
93 views

Checking whether a number starts with any of a list of string prefixes

This code will return false if the long double rand begins with any string in the vector ...
7
votes
1answer
1k views

Signal simulation through Python scripts using shared memory for testing a C application

This is bit long, but I need to explain something before I can ask for actual reviews/advice. I have to test generated C code from Matlab Simulink model. I can create a executable binary from those. ...