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
0answers
11 views

Project Euler 8 - Redux

Spurred by this question: Project Euler #8 I decided to try to solve it with as clean code as possible. Here is the problem formulation: The four adjacent digits in the 1000-digit number that ...
12
votes
1answer
107 views

Chack miy spellang pleez

For my CS2 project, I am supposed to implement a spell-checker. It is supposed to follow the following: Prompt the user for the name of the file containing the dictionary of correctly ...
1
vote
0answers
21 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
27 views

Asynchronously load and unload a queue

This code is supposed to asynchronously load a queue from a generating function. ...
2
votes
0answers
46 views

SImple wrapper for OpenGL

I am writing a simple wrapper for OpenGL for personal use. Currently I have a gl::Buffer (for VBO, EBO etc...) and it can have several types (...
11
votes
2answers
122 views

Toy virtual machine

I am a web developer, trying to have fun with C++11, so any positive/negative feedback is very welcome. This is a toy virtual machine with 3 registers and 3 commands: vm/vm.h ...
8
votes
2answers
75 views

Type-safe cartesian co-ordinates

I've recently been fiddling around with a type safe implementation of cartesian co-ordinates (and a few operations on those co-ordinates). Often it's easy to get units mixed up: is something in ...
4
votes
4answers
105 views

Extremely simple character manipulation

Given a string, this code Multiplies odd numbers Subtracts even numbers, do nothing if only one even number is found Turns uppercase letters to lowercase and vice versa I think this code is too ...
5
votes
2answers
145 views

“Set” your expectations low for this ADT

For my third assignment in CS2, I was given the following: A set is a special bag that does not allow duplicates. Specify each operation for a set of objects by stating its purpose, by ...
2
votes
0answers
52 views

Efficient compile-time directed graph

During my research in Rigid Body Dynamics, (where Contact Graphs are used to solve the contact problem) I came across the question if it is possible to define at compile time a directed graph (class) ...
4
votes
2answers
78 views

String Token Generator for ExpressGenGen

StringTokenGenerator is an interface (or abstract class) I've created to the specific task of generating a string token of a given character set. It allows ...
5
votes
1answer
106 views

Minimum number of coins - (dynamic programming solution - topdown approach)

This is a problem from topcoder tutorials Given a list of N coins, their values (V1, V2, ... , VN), and the total sum S. Find the minimum number of coins the sum of which is S (we can use as many ...
3
votes
1answer
63 views

Reading from a CSV file in C++

I wrote this code to read from a CSV text file (containing data such as 12,3,568,48,3,8 with no more than 3 digits to each number). It stores the numbers as char arrays in the vector ...
3
votes
1answer
33 views

Serialization: Step 2 YAML Parser

After this question, the next part. Coding to the same interface as the previous question: Note: Since not every system has libyaml installed, the config script tries to detect its existance and ...
14
votes
4answers
1k views

Smart as a bag of rocks

For my second project in CS2, I was given the following assignment: Implement a new ADT called a bag with receipts. The specification for the class of bag with receipts differs from a ...
2
votes
2answers
86 views

Project Euler - Smallest multiple

Here's Problem 5 - Smallest multiple 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly ...
2
votes
0answers
25 views

Directed Acyclic Graph with topological sort

I have here a class which represents a directed acyclic graph (Graph) and a vertex in the graph (Vertex). The vertices are ...
3
votes
1answer
42 views

Generalized Suffix Tree implementation

I've started to write a Generalized Suffix Tree implementation. The overall code is still in an experimental state, though I think it's mature enough to ask for a little review. I'd like to know how ...
5
votes
3answers
175 views

A partition algorithm for positive integers

I have encountered the following problem that I found very interesting to solve: Given an array of positive integers {a1, a2, ..., an} you are required to partition the array into 3 ...
3
votes
0answers
49 views

Generating all permutations of a template pack

AllPermutedPacks<Pack<Types...>>::type is to be the pack of packs consisting of all permutations of Types.... For ...
2
votes
0answers
55 views

Linked list order reverse program efficiency

Here is my function which convert linked list in the following order: Example: Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3 Output: 3->2->1->6->5->4->8->7->NULL. Code: ...
2
votes
1answer
86 views

Iterator requirements for a fake container supporting C++11 range-based for

Around a year ago, I wrote this Stack Overflow answer where I suggested an idea to replace deeply nested loops with a single iterable virtual-container object that "contains" all the indices. The ...
3
votes
1answer
69 views

Generating a zoo of animals

The pattern I've come up here is for the AnimalGenerator itself, outside of the (abstract) Factory Pattern used within it. The factory classes themselves are not ...
2
votes
0answers
82 views

Simple Win32 console library (mimicking almighty SFML) - follow-up

I'm trying to mimic the SFML library to be suitable for text-based games. The library called MSLIB in GitHub here. Here is a sample of the library implementation. It prints gray square onto the ...
5
votes
1answer
284 views

C-ifying a capturing lambda

What do you think of this code: ...
6
votes
3answers
173 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
180 views

Constructing a class from a line in a parameter file

I've got a problem where I need to parse a line in a parameter file of the form PotentialName [... variable number of parameters] I've got code which works ...
3
votes
2answers
93 views

Simple C++ thread pool

I wrote a minimalistic thread pool using some C++11 features. I've used it on two projects so far and it has worked fine, but when I ran the code on my laptop, I believe that my thread pool might be ...
1
vote
0answers
39 views

Simple Win32 console library (mimicking almighty SFML)

How can I improve it? ...
4
votes
2answers
43 views

Cubic “bezier” curve of grade n

This is code I wrote for calculating bezier curves as quickly and RAM efficiently as possible. I would like to know if there are faster ways to optimize anything, because I am very new to C++ and ...
3
votes
1answer
62 views

Simple concurrent freelist

To become better acquainted with the Intel Parallel Studio XE profilers I'm currently messing around with a simple concurrent freelist. I'm fairly certain that it's thread-safe. It uses Acq/Rel ...
10
votes
4answers
653 views

Knowledge is power

Resurrecting my C++ saga, I was given this project for my CS2 class: This problem considers several ways to compute \$ x^n \$ for some \$ n \ge 0 \$. Write an iterative function ...
6
votes
1answer
82 views

C++14 Async Task Scheduler

I'm not sure if this site has the right audience for anyone to be able to respond to this, but I wrote a header only scheduler which schedules a task to be run in the future on another thread: ...
7
votes
1answer
49 views

sha1sum implementation in C++

I rarely program C++ in anger, and considered myself somewhat rusty, and certainly not up to speed on C++11. For a bit of exercise, I thought I'd try implementing sha1sum, as wasn't really up to speed ...
3
votes
0answers
33 views

Entity component system for text based console on Windows

I have written this code base on AsciiEngine How can i improve this code ...
10
votes
2answers
234 views

Meta-programming template for collection statistics

I find that I often want to calculate summary statistics from collections of data and decided to create a template to do that. I'm interested in a general review, but I also have some specific ...
3
votes
3answers
284 views

Convert an array to a binary tree

I wrote this code in C++ to convert an array to a binary tree. For instance, int nums[] = {7,5,9,1,7,3} to a binary tree (root-7, root's left child-5, root's right ...
4
votes
2answers
214 views

C++ smart pointers and classes

I've started learning C++ recently and want from what I've gathered smart pointers are the way to go when storing stuff on the free store. I want to make sure I've got the basic hang of C++(11) ...
3
votes
2answers
404 views

Hacker Rank - Lonely Integer

This is the problem statement for Lonely Integer. There are N integers in an array A. All but one integer occur in pairs. Your task is to find out the number that occurs only once. Input Format ...
1
vote
1answer
50 views

C++ Readable serial constant range counter [closed]

What I am asking here is about code readablity. Consider the following code: ...
6
votes
1answer
118 views

HackerRank - Insertion Sort - Part 2

This is the problem statement for Insertion Sort - Part 2. In Insertion Sort Part 1, you sorted one element into an array. Using the same approach repeatedly, can you sort an entire unsorted array? ...
15
votes
2answers
234 views

Hangman on the C++ommand line

I'm wondering if my code is just a tad too long to post here, but if the only consequence seems to be getting high-level reviews, then that's perfectly fine. This is my implementation of Hangman in ...
3
votes
0answers
69 views

any that can hold arrays

I've tried to make a better any than before: ...
1
vote
0answers
30 views

Max independent set of a sequence

This is the code I've written to find the maximum-weight independent set of a graph path. It's a standard problem with a well-known dynamic programming solution of linear complexity. Since it's a ...
1
vote
0answers
37 views

Text-based Snake game on Window - follow-up 2

Previous question: Text-based Snake game on Window - follow-up Summary of improvements: Corrected the names of classes and members data Implemented Console ...
3
votes
0answers
75 views

Compile Time Constant Map

I have implemented this compile time map as a way to learn templates and constexpr classes: ...
6
votes
2answers
111 views

Harmonic partial sum calculator with multithreading

I wrote a program which computes the harmonic partial sum to N terms with multithreading capability. I've been working on this to sharpen my C++ skills for the upcoming semester. Just wondering if ...
1
vote
0answers
25 views

Technique to destroy classes and mutexes used by several concurrent threads [closed]

I would like to get some advice and reviews regarding to the following code: Code 1: ...
4
votes
2answers
93 views

Text-based Snake game on Window

How can I improve this game? ...
4
votes
1answer
51 views

C++11 lock free collection similar to std::forward_list - follow-up

Thread safe and lock free collections are very hard to write, so I'd appreciate any feedback, especially regarding bugs. The code below is a self contained cpp including some tests. This question is ...