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

learn more… | top users | synonyms

1
vote
1answer
36 views

boost::spreadsort for std::pair

Boost 1.58 has new library spreadsort, so I tried it out. I wrote simple sample for sorting vector of pairs of int: ...
2
votes
1answer
41 views

ThreadPool based on ASIO, using a particle emitter

This code exists in my home repo and in general nobody else has really touched it. Living in such a vacuum has left me kind of uncertain of the actual code quality and correctness which is why I am ...
4
votes
1answer
53 views

Distance between angles as points

This code calculates the distance between angles, particularly for n-tuples of angles. One example where this situation occurs is as follows: I'm using a 2 arms, one 6 degree of freedom and the other ...
3
votes
2answers
112 views

A program to shred files

The following is a program to shred files securely: ...
2
votes
1answer
43 views

Two error-reporting conventions for a command-parser

I need to implement some function and I would like to report about a fail made inside a function. If function doesn't fail I need to get a some result (for example, ...
8
votes
1answer
106 views

Implementation of a new kind of smart pointer in C++

I'm tempted to write a new kind of smart pointer which, I believe, is less intrusive than boost::intrusive_ptr and has the same memory footprint. The code for the ...
4
votes
3answers
111 views

Directory Snapshot

The following code creates a recursive backup of a directory in the form of interlinked HTML files, structured in the same form as the input directory. It does not take the backup of the contents ...
1
vote
1answer
112 views

Asynchronous connect() with one function call, using C++11 lambdas and Boost.Asio

I've wanted to write a C++11 class for making IPv4 TCP connections and figured that it probably could be done with just one static function using some shared_ptr and lambda "magic". The following code ...
2
votes
0answers
107 views

Multi Server Architecture: ASIO C++

I am working on an application where the user will have flexibility to create and destroy a server instance at any port he/she wishes. User can create multi servers operating simultaneously - each ...
1
vote
0answers
49 views

Template based return type from object and class method

I'm looking for a better implementation of this. The current solution looks bad to me and breaks the VC10 compiler if you call Create() with a method expecting two ...
6
votes
3answers
187 views

Code Generator Generator

I've created a code generator generator, which is hosted here. I need its parser portion reviewed for OOP, OOD, and C++ best practices. gengenparser.h ...
5
votes
2answers
227 views

Thread-safe Phoenix Singleton class template with Boost

I've implemented the phoenix-singleton as a class template with boost inspired by Modern C++ Design. The code compiles fine with MSVC 2013 - and it seems to work, but I'm new to multi-threaded ...
11
votes
2answers
199 views

Elementwise iterator adaptor

There are many C++ implementations of the Euclidean vector. I.e., a vector in what is typically a 3- or 4-dimensional space. Something along the lines of ...
7
votes
1answer
234 views

Get extension(s) from path

I'm writing an utility function that returns the extension(s) of a boost::filesystem::path (v3). Boost's path class already has some of this functionality ...
6
votes
2answers
114 views

A reversed-string Trie data structure

This is a simple Trie data structure for strings, except it puts the strings into the structure backwards. The insert method simply iterates over chars from the string-to-be-inserted backwards, and ...
3
votes
1answer
209 views

Program that handles program options

I'm using boost::program_options to parse input from the user. However, while the standard library makes this an easy task to do, it's causing an (in my opinion) ...
2
votes
0answers
76 views

Wrapping boost accumulators

Here is a namespace for wrapping boost accumulators for use in a broader code base. I love these accumulators but re-typedefing them everywhere is ugly and a pain. ...
2
votes
1answer
161 views

Producer - Consumer interaction

I have an implementation of Producer-Consumer multi-threaded interaction.It works.But I feel that during the execution wait states happen too often between Consumer ...
6
votes
1answer
173 views

Predictive recursive descent parser for math expressions

I've been learning about language theory and parsing, and decided to write my first parser: a LL(1) recursive descent parser. But actually, it does a little more than just expressions; it can also ...
1
vote
1answer
207 views

A class for simple and efficient operations on boost::unordered_set

I wrote this class to perform simple template-set operations on boost::unordered_set. These operations are part of a larger code base. Calling them will be explicit ...
7
votes
1answer
513 views

Portable C++ boost::iterprocess::mutex

I was looking for long time around to have a portable robust solution for multiprocessing synchronization. Who touche this things know that good solution are boost::iterprocess named sync objects. ...
5
votes
1answer
244 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 ...
4
votes
1answer
239 views

Simple parsing for string formatting

Recently I submitted some string formatting and printing code (found here) that I wrote as an small exercise. It was implemented naively using string replacement. This time around I wanted to actually ...
10
votes
1answer
281 views

String-formatting and printing functions

As a small exercise I have written some string formatting and printing functions in C++11. I would like a bit of code review, not so much on the merits of using this over something like ...
2
votes
3answers
255 views

Boost::range::for_each + functor

I would like your comments on my code in C++ (C++98 + Boost) I have written some code to use the functors with the boost::range::for_each algorithm. My main ...
6
votes
2answers
1k views

Multiple dispatch with variant and multi visitation in C++

The following program is a demonstration of variant and double visitation used to obtain double dispatch between the elements of two inhomogeneous containers. Most of the work is done at compile time. ...
9
votes
1answer
3k 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 ...
7
votes
2answers
565 views

Simple and efficient boost::unordered_set intersection

I wrote this function to do unordered_set intersection using templates. I have seen this answer but I thought that is was overkill. I would like the method to take ...
4
votes
1answer
117 views

Template with boost::operators extremely verbose and repeating

I got the following ugly code: ...
4
votes
0answers
377 views

Smart pointer memory pool

I'm using a third-party library which utilizes boost::shared_ptr for memory management. The problem is that I need to allocate many objects and I have detected ...
4
votes
1answer
290 views

Converting data when output std container via ostream_iterator

I have a strongly typed enum and std::vector of this type. ...
4
votes
0answers
116 views

Reading Intervals from command line

I want to parse a command line using boost.program_options. Most of my command line arguments will be intervals, which I could implement as something like ...
11
votes
1answer
437 views

Partitioned Multikey Map

Below is the code for what I've called a partitioned_multitype_map. This has two major facets: Allowing a lookup based on keys of multiple lengths and of multiple ...
4
votes
1answer
242 views

Boost multi-index based orderbook

As suggested here, I'm using Boost multi-index to implement orderbook. So far my code looks like this: "CommonsNative.h" contains ...
7
votes
1answer
178 views

Moving method from derived class to base

I've some classes (Derived1, Derived2, etc.) derived from class Base. All of derived classes ...
5
votes
4answers
1k views

Converting std::string to int without Boost

I'm trying to convert an std::string to an int with a default value if the conversion fails. C's ...
3
votes
0answers
396 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. ...
6
votes
2answers
4k views

Multithreading C++ loop

I've made a small skeleton for a larger project that will include cross-platform multithreading (by using Boost) and thread-safe random numbers (by using GNU scientific libraries and mutexes). My ...
2
votes
0answers
1k views

Event system using callback functions in C++

I am learning C++ and have been trying to create an event system for use in a small game. This will be the mechanism by which game entities communicate. I would be eternally grateful if someone with ...
6
votes
1answer
522 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. ...
13
votes
1answer
7k views

Efficient smart pointer implementation in C++

The idea behind this is mainly educational but I might even consider using it in reality if turns out to be good. Here's my first try at implementing smart pointers: ...
3
votes
1answer
108 views

Selecting element from a collection based on bitwise-and result

I need to improve this section of code: ...
2
votes
1answer
3k views

Boost Threads - Producer Consumer threads with synchronization - Review

I have below code for multi threaded consumer and single producer. Kindly review it ro concurrency correctness. ...
12
votes
2answers
328 views

Handling game states for an online RPG game

I'm writing an ORPG. The code below is client-side. I have a main thread looping in Game::Run: ...
12
votes
4answers
1k views

Force locking for thread-safety

After reading Herb Sutter's Associate Mutexes with Data to Prevent Races, I found that my solution was superior in several aspects, least important first: The code is cleaner, without macros No ...
5
votes
0answers
121 views

Take two on type to instance map

I realised that what I was doing wasn't particularly smart, so I switched to a different approach. This costs more dynamic allocations but has a much simpler implementation: ...
2
votes
1answer
252 views

Singleton Boost-based timer

I would like a review on this code, and how I could make it better. ...
2
votes
2answers
868 views

boost::thread producer consumer

I am new toboost::thread and am making a producer-consumer with a Monitor. This is how I've coded it so far: ...
12
votes
2answers
987 views

Boost Python converter for std::tuple

I could not find a Boost Python converter which converts std::tuple, so I wrote one. This was tested with a g++ 4.7 snapshot on Debian squeeze. It uses C++ 11 ...
7
votes
3answers
1k views

Boost CRC example program file

I'm currently looking at this Boost::CRC example code which I have also inserted below. I always try to look for suggestions for improving my own coding style when I encounter well-written and ...