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
2
votes
0answers
33 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 ...
0
votes
0answers
20 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
35 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
69 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
88 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 ...
9
votes
3answers
14k 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
72 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
140 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
172 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 ...
22
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
45 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
73 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
97 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
138 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
186 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
109 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
129 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
876 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
vote
1answer
242 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 ...
-1
votes
1answer
79 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 ...
12
votes
5answers
3k 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
66 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
68 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
76 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
147 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
187 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
299 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
413 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
124 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
2k 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
41 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
223 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
119 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
144 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
91 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. ...
2
votes
2answers
163 views

Random Number Generator Followup: Choosing the Generator Algorithm and the Distribution

This question is a follow-up from my previous code review question. This question regards the ability to choose a predefined random number generator algorithm and also choose a generator distribution. ...
10
votes
1answer
177 views

Random Number Generator with Loads of Useless(-ish) Features

For fun, and to refresh my memory on Boost's program_options library, I have written a program with the goal of randomly generating numbers with loads of useless(-ish) features. I have termed it ...
4
votes
0answers
679 views

Boost Asio Listener

I have developed a piece code to listen on a socket using Boost::asio. I would like to use that code in production. But before that, I would like to test it and ...
3
votes
0answers
73 views

Retrieving a certain amount of data from a socket [closed]

I'm trying to retrieve a certain amount of data from a socket, both Unix domain and TCP, but I've no control over its format or length. I discussed this with someone who told me to set my receiving ...
7
votes
2answers
309 views

Calculating a ton of mathematical constants

For a while now I have been working to construct a program to calculate a lot of mathematical constants. Before I explain, here's the code: Code ...
4
votes
3answers
250 views

Completed Makeshift Bash & Makefile To Compile C++ Examples

I am just experimenting with Bash and Makefiles to make my life easier, and here's what I came up with. Scenario: Files are in a directory containing a tutorial, or an iteration. For example, one ...
2
votes
3answers
2k views

C++ fixed-size queue full/empty signaling

I'm considering an application where a large data needs to be written to file often. I would like to use a queue and have a producer and consumer running on different threads. Additionally, I would ...
1
vote
1answer
199 views

A wrapper on top of boost vector

Please review the following piece of code. The class implements a light weight wrapper on top of boost::container::vector. I am not getting the expected performance — nowhere comparable to std::vector....
7
votes
2answers
2k views

Generic pipe and filters

I made a template pipe and filters to replace an old pipe and filters implementation that used inheritance and had a very heavy base class. ...
6
votes
1answer
363 views

Double exponential quadrature

I'm trying to lighten the code review load for the maintainers of boost.math, and I was hoping you guys could help me out. I have a pull request which implements tanh-sinh quadrature, which is ...