Stack Exchange Network

Stack Exchange network consists of 174 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".

0
votes
1answer
50 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
45 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
54 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
63 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
57 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
145 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
113 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
157 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
176 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
823 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
112 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
35 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
79 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
110 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
88 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
707 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 ...
0
votes
0answers
748 views

Producer/Consumer with Boost.Interprocess (shared memory) using condition_variable

I do have to dive into concurrency with C++11 at the moment and I am having a very hard time to get a basic producer/consumer to work with Boost.Interprocess using shared memory. I've already tried a ...
7
votes
3answers
6k 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
109 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
152 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
84 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 ...
0
votes
0answers
253 views

Common fast and efficient C++ Value class

I need a duplex bus to send/receive messages between modules. Message is a container, contains fields and link to metadata. Messages serialized/deserialized in/from BSON. I need a common value. I need ...
4
votes
0answers
471 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
68 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
261 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
158 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
135 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
154 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
279 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
125 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
139 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
137 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
129 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
118 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
623 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 ...
1
vote
2answers
4k views

time_t to string

...
1
vote
1answer
115 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
2k 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
588 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
65 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
186 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. ...
3
votes
0answers
251 views

Recursively generate combinations while using Boost Coroutines

I've tried out implementing a combination generator using boost coroutines. It accepts an array of possible values and generates one array at a time for each combination. As a limitation, it only ...
1
vote
0answers
171 views

Boost::python class overloading, issues in exposing more than one constructor

I am very new to boost::python and I am doing the first experiments. The following code works, but how to improve the code exposing also the non empty constructor? Some failed attempts have been ...
6
votes
0answers
3k views

I am using boost::process to call an external process, and using stdout, stderr, and stdin to supply/retrieve data

I have some program which takes input via stdin, writes output to stdout, and errors to stderr. I would like to call that program from another program, supplying data via stdin, and capturing output/...
2
votes
3answers
1k views

Calculate the crc32 of the contents of a file using boost

I'm computing the crc32 of a given file using boost: ...