Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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".

1
vote
0answers
9 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 ...
2
votes
0answers
26 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 ...
2
votes
1answer
38 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
49 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
107 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
98 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: ...
0
votes
1answer
72 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 ...
1
vote
1answer
117 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
67 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
2k 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
65 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
58 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
146 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 ...
6
votes
2answers
142 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
219 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
2k 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
265 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 ...
1
vote
0answers
1k 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- <...
7
votes
2answers
118 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
36 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 <...
2
votes
1answer
96 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 ...
3
votes
0answers
146 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
101 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 ...
3
votes
3answers
1k 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 ...
7
votes
3answers
9k views

Filter out elements from std::vector

I have ended up to following code in order to filter out some bad elements from an std::vector: ...
2
votes
2answers
134 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
157 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 ...
5
votes
2answers
85 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 ...
4
votes
0answers
561 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
71 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
284 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
202 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 ...
11
votes
1answer
139 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 ...
1
vote
1answer
175 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....
6
votes
1answer
298 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 ...
4
votes
0answers
128 views

Accept constructor arguments from a given subset of types

I found myself often in the position that I want to have multiple arguments in a constructor which could be in any order. For example: ...
7
votes
1answer
143 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 ...
4
votes
1answer
174 views

Brute-force search for solution to an unsolved mathematical inequality

From this Wikipedia article, the following unsolved problem is presented as a result of Waring's problem: It has been proven that a finite number of k exist, and so far none are known. The follow ...
3
votes
1answer
158 views

TCP retarder for network delay simulation

I would like to simulate delay over network, for that I have implemented a simple retarder (=introduce random delay while maintaining order of messages) using Boost to handle sending itself. It ...
3
votes
0answers
72 views

A matrix class for objects other than numbers

I'm in the process of writing a matrix like container to store objects. Despite many existing matrix implementations, I won't do numerics. Instead I want to replace a ...
3
votes
0answers
139 views

A way to automatically reorder struct fields by their sizes in descending order

Using constexpr and preprocessor magic it is possible to cook a struct which have a minimal size between all possible sizes, keeping all the data members properly ...
5
votes
2answers
802 views

C++ Query String Parser

This query string parser is intended to parse the parameters and values of a parser query string. I'm particularly concerned about my use of std::move(...). I ...
2
votes
2answers
5k views

time_t to string

...
1
vote
1answer
119 views

SDel file deletion utility

SDel is an open-source command-line utility for secure file deletion. (For me personally, it is also an attempt to refresh my knowledge of modern C++ after a long period of using C.) SDel Alpha ...
6
votes
1answer
3k views

HTTP downloader using Beast

I have written a small HTTP downloader using boost::asio Beast library (proposed to be included in Boost) network::uri library ...
4
votes
4answers
631 views
3
votes
1answer
1k views

Detect if string contains more than 1 period

This function returns true if the string contains zero or one periods, and returns false if the string contains more than one ...
1
vote
0answers
72 views

Pimpl helper class

I have started to utilize the PIMPL pattern in my code. I do not have access to C++11 etc. but do have access to Boost. The code must be able to compile on C++03 compilers. I decided to write a ...
4
votes
1answer
2k views

Boost::Asio server

This is my first time trying to do anything proper in Boost::Asio, so I would love if someone could look at it and tell me if it makes sense. It's based on examples ...
2
votes
2answers
223 views

Relaying stdin data from one thread to another

I'd like to know if this piece of code is thread-safe. I'm learning something about threads, queues and synchronization, and I'd like to make sure this is correct, before moving forward to next step. ...