C++11 is the successor to the C++03 standard, adding various core language changes and fixes, and an improved and expanded standard library.

learn more… | top users | synonyms (1)

2
votes
1answer
33 views

Stack implementation with shared_ptr C++11

stack.hpp ...
4
votes
0answers
36 views

Simple ini file parser

The below is a C++ parser for a reasonably simple INI grammar (although my understanding is that there isn't an official spec as such). My grammar is roughly: ...
4
votes
1answer
40 views

Initializing a std::array from a recursive template computation

I wrote this code for an answer over on SO. I suspect it's possible to clean it up a bit, particularly the base-case specialization for FactorialArray, which is ...
5
votes
2answers
67 views

NamedPoint class using unique_ptr for members

After reading this old article from 2001 I have tried to implement the class from it using unique_pointer. An author's claim is that C++ is not appropriate for ...
1
vote
1answer
61 views

Check if vector of strings has matching brackets

For an online screen, I had a question that would take in a vector of strings, and return a vector of strings indicating whether the input string was a valid combination of ...
3
votes
2answers
55 views

C++ Socket syncronous poll wrapper

Below is a simple C++ abstraction over linux sockets, and a layer of abstraction over a synchronous poll call. The goal was to exploit move semantics to allow the ...
7
votes
2answers
127 views

Circular Buffer C++11 Implementation

Here's the implementation of a common data structure I use at work, mainly for logging purposes. I tried to make it C++11-compliant, but even if this standard has been around for a few years, it is ...
1
vote
3answers
58 views

Functor to compare two floats with tolerance

What do you think about this implementation of 2 floats comparison functor considering how tolerance is introduced? ...
2
votes
0answers
28 views

Views and ranges for tuple-like objects

This interesting idea came up when I was designing the for_each for tuple-like objects in this post. The for_each in that post ...
7
votes
0answers
65 views

Parse regular expression

Task: This function searches given null terminated string pStr by given subset of regular expression pMatch. Return value is ...
1
vote
0answers
51 views

In-memory B+ Tree in C++

I know B+ trees are not meant to be use in memory, but I just implemented it as an exercise. I'm looking for a general review. ...
11
votes
2answers
481 views

Beep-beep I'm a car factory

I have implemented to following generic factory in C++11 using smart pointers and I would like to get some feedback about it. (Please note that I can't use C++14) Due to company policies I have to ...
5
votes
1answer
66 views

Reuseable C++11 Thread

I'm learning about threading support in C++. I've got a basic understanding of thread-pools and why creating and destroying threads on some systems can be expensive. As far as I'm aware C++11 doesn't ...
4
votes
1answer
65 views

Generating vertices of the rectified hypercube

The following piece of code generates the vertices of the rectified hypercube in arbitrary dimensions. The 3D case of the rectified hypercube is a cuboctahedron with 12 vertices (±1,±1,0), (±1,0,±1), (...
5
votes
1answer
66 views

AVL Tree implementation in C++

I'm looking for a general review of this AVL tree implementation: ...
3
votes
2answers
84 views

C++ finalizer template

Consider, please, my code of the finalizer template: ...
0
votes
1answer
24 views

Averaging outputs of each execution of a file

The only way I could think of doing this is creating a text file and modifying it each time the program is executed and outputting the average but this has many flaws so I was wondering if it was ...
2
votes
0answers
57 views

In-memory B-Tree

I know B-Trees are meant to be used for external memory, but I implement it to understand the algorithms involved in insertion and deletion. Also, I didn't use a vector because I was asked not to use ...
2
votes
1answer
46 views

Template function which determines how to move-assign a type

In some code that I am writing, I am manipulating some heterogeneous containers of user-defined types. I desperately need to be able to move-assign these types without generating exceptions. However,...
1
vote
1answer
40 views

Calculate the crc32 of the contents of a file using boost

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

Invocation list implementation (signals/slots)

This class is mostly an educational exercise for me using some C++11 constructs. I wanted to create something similar to an "invocation list" in C#, i.e., a list of zero or more function objects which ...
4
votes
1answer
73 views

Generic singly linked list using the C++11 standard

This here is a templated singly linked list that I have been working on for the past couple of days in C++. I am not a programmer or computer scientist by training; finishing up my undergrad in ...
4
votes
1answer
84 views

Linked List with c++ class

I am playing with a sort of linked list using C++ classes. I have used a lot of C linked lists (struct based) during C programming course, but there was no behavior. Thus, I am a bit confused about ...
4
votes
3answers
128 views

Producer/consumer problem with four priority levels

Here you can see a mediocre code of mine where I have fun with four deques, each with a different priority. Here is how it works: in a ...
5
votes
0answers
67 views

ASCII dungeon generator [closed]

I've written a simple ASCII dungeon generator. What are your thoughts on the code and coding style? Algorithm: Choose random point on "canvas" (two-dimensional array of chars with user defined size)...
4
votes
1answer
79 views

Knights Tour - Improved Refactored Recursive Breadth First Search for

The development and testing was performed on a Dell M6400 Laptop (Intel Core 2 Duo) running Centos 7, g++ compiler version 4.8.5, compiler switches -O3 -std=c++0x -D__cplusplus=201103L. (machine ...
0
votes
1answer
55 views

Pretify JSON class -followup

This is a follow up to this question. This is an improved version in accordance to comments, suggestions and reviews. Is the namespace implementation proper? is the code readable? I didn't want to ...
2
votes
1answer
56 views

Implementation of a C++ IOC container

I have created a pretty simple IOC container for C++ that should allow me to write less coupled code in the future and make my code easier to unit test. Overall I am fairly happy however I feel like ...
9
votes
3answers
1k views

Prettify JSON class

It's not much, but I tried employing some of the things I learned yet never really got to use, since that kind of code isn't really needed where I work (for the most part). I tried making it as much C+...
3
votes
0answers
44 views

Password & Shadow File Mockup

I tried to implement something similar to linux shadow.txt file and I am not aware of concepts such as memory fingerprinting. Could someone please review this code : ...
2
votes
1answer
63 views

A nonstandard “shared pointer” of sorts

In a few of my projects, I had sort of a common situation, where I wanted to share a pointer to some object, and I want the recipient to be able to check if it is still valid, but I don't want them to ...
11
votes
1answer
90 views

Sketch of Chutes and Ladders game

The classic Chutes and Ladders game has a grid of 100 squares with various "chutes" (which send a player backwards) and "ladders" (which promote a player forward). The goal here was to randomly ...
2
votes
1answer
85 views

Pointer lists for a C++ garbage collector

The problem My intention is to have a class A and class B. class B has a ...
1
vote
1answer
71 views

Listener callback functions

I wrote codes that listener and callback function like this: ...
5
votes
1answer
142 views

Simulate Turing machine

I have written this code to simulate a Turing machine and wonder what could be improved. In particular, the --tape.end() seems a bit dodgy. ...
4
votes
1answer
92 views

C++ Wide string utility class

I created a class to add functionality to c++ std::string (std::basic_string actually), let's call it ...
1
vote
0answers
35 views

Using lists of types to specify types conversion order for operations

I want a mechanism for specifying arbitrary order of type conversion for arbitrary set of types for each operation on that types (separately). For example, let's have set of types ...
4
votes
2answers
104 views

Bulk HTTP request queue consumer

Today I had to write a small tool to help me send HTTP requests in bulk. Rabbit was overloading my server, so I decided to change my consumers to buffer the contents of the request, before sending. ...
4
votes
1answer
101 views

Simple binary search tree for use in programming competitions

I made a binary search tree implementation in C++ for my personal use in programming competitions. ...
3
votes
1answer
69 views

Simple Vector2D and 3D class

So I implemented a simple vec2 and vec3 classes, I wanted to know what remarks you guys can give me to improve it. I try to work with c++11 and 14 so remarks on that also will be really great. I ...
3
votes
1answer
70 views

C++11 Quicksort any container

As the title says, simple quicksort to help myself get used to C++ templates and iterators. Main concern is whether there's a better way to template so that you can have a simple function (e.g. ...
2
votes
1answer
52 views

Find all distinct combinations of letters in a string

I've been preparing for interviews and picking up modern C++. A recent prep question I did was to find all combinations (or distinct subsets) of letters from a string. E.g. ...
3
votes
0answers
41 views

Same PyObject for a shared_ptr C++ object

I have a similar problem as in this mail. I want that every time I return the same C++ managed object to Python, I get the same PyObject. With the standard ...
4
votes
1answer
80 views

Finding two indices of numbers which sum to N

I'm solving some online puzzles and I had this problem: Given a vector, write code to find the indices of TWO values which sum to a given number N so if I'm given [2, 5, 6] and N = 8, I should ...
3
votes
0answers
82 views

C++ variant and variant subsets

I seem to be in a love-hate relationship with C++. It can make some parts of your code elegant and easy to grasp, and some others become an inconceivable mess. And it's not the language itself causing ...
1
vote
0answers
36 views

Shortest bitonic tour

This a solution to the shortest bitonic tour using dynamic programming. Bitonic tour starts at the leftmost point then goes strictly rightward to the rightmost point and finally strictly leftward to ...
0
votes
1answer
93 views

Deleting duplicate elements from a single-linked list in C++11

The code below is a simple coding exercise I got from a book that asks to remove the duplicates from a single-linked list (using a simple struct; this is part 2, ...
1
vote
0answers
54 views

Longest palindrome subsequence

This algorithm finds the longest palindrome that is a subsequence of a given input string in \$\Theta(n^2)\$. Example Input: character Output: ...
3
votes
1answer
74 views

Pong game with a random twist

I made a simple Pong game using SDL2, with a twist: You don't get to play :), only the 2 AIs get to. ;) Because Pong is a very small game, I put everything in a single file (...
8
votes
2answers
120 views

Histogram generator

This is some code to generate a histogram (or maybe: histochart) in the form of a simple list of words and how many of that word were found in the input file. It accepts an input file name on the ...