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)

1
vote
1answer
31 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
43 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
57 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
79 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
111 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
62 views

ASCII dungeon generator [on hold]

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

Knights Tour - Improved Refactored Recursive Breadth First Search for

This development and testing was done on a Dell M6400 Laptop (Intel Core 2 Duo) running Centos 7, g++ compiler, compiler switches -O3 -std=c++0x -D__cplusplus=201103L. (machine bought August 2009 with ...
0
votes
1answer
54 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
47 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 ...
8
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
41 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
62 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 ...
10
votes
1answer
78 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
81 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
67 views

Listener callback functions

I wrote codes that listener and callback function like this: ...
5
votes
1answer
141 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
86 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
34 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
100 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. ...
0
votes
0answers
16 views

Multi threaded program hangs on condition wait [migrated]

I have the following piece of code. I am using c++11 threads to write a simple multi threaded producer consumer problem. ...
4
votes
1answer
98 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
68 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
69 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
49 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
39 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 ...
3
votes
1answer
74 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
78 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
31 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 ...
-1
votes
0answers
39 views

Spaceship Arcade Battles V0.1

I am trying to implement something like this spaceship shooting game using SFML and Box2D. I don't know how my code is. Please, look and criticize. Well, I've put here most important classes. The ...
0
votes
1answer
90 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
45 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
73 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
115 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 ...
0
votes
3answers
84 views

Extend number of arguments in std::hypot

I would like to call std::hypot with many arguments (not just 2 or 3). Mandatory requirements: fast run at compile time when possible Non-mandatory requirement:...
3
votes
1answer
89 views

A different way to execute a hangman game

Most hangman implementations I have seen keep a list of characters the player has already guessed and compares them to the players current guess each time to see if they have already made the same ...
5
votes
2answers
102 views

Building a simple singly-linked list in C++11

The implementation below works, but I'm wondering if there's a modern C++ alternative. For example: Should I replace the raw new with a braced initializer? ...
4
votes
1answer
46 views

Monitor and video mode querying

I am working on a large project that requires information about the monitor(s). Please don't be confused by the organization of the following structs. The design intent is to be cross-platform, so ...
1
vote
2answers
45 views

Crawling SPOJ through cURL and C++

I am trying to write industry standard code. https://www.quora.com/How-do-I-follow-a-user-on-Spoj-for-solving-problems-Refer-Details Someone gave me this A2A. And I wrote this code for it ...
2
votes
3answers
85 views

C++11 Blocking Queue learning exercise

As part of my own C++11 learning exercise I have implemented this Blocking Queue using the new C++11 thread API. One of the aspects I would like to improve is efficiency i.e. in the ...
3
votes
3answers
94 views

Counting the number of primes in C and C++11

I found this old piece of code that I wrote while I was learning C a while back: ...
2
votes
1answer
126 views

Find shortest paths in a matrix using Dijkstra's algorithm

The problem is as follows: I have a matrix with impassable fields those are marked by the input. There is also a castle which reaches up the right side of the matrix. I have to find how many paths ...
3
votes
1answer
89 views

Maxflow for baseball elimination game

I have a problem similar to the baseball elimination. Given some teams, the number of wins they have and the number of games they have left between each other I have to find for which team it is still ...
1
vote
2answers
42 views

SPOJ “TESSER” - Getting TLE using KMP algorithm

The TESSER - Finding the Tesserect problem is tagged as a problem to be solved by Knuth-Morris-Pratt (KMP) algorithm. I'm using KMP, but am still getting time-limit-exceeded. Task Each of T test ...
4
votes
0answers
39 views

No-copy cache line aligned function storage object with small object optimization

I have implemented a std::function-like class, that is optimized for storing lambdas, that never copies the stored function, that has a small buffer to store ...
1
vote
0answers
53 views

Performance of critical function (STL transform)

I have finished the first part of my project, i.e., getting a full working program. However, the performance is not too impressive. The function ...
3
votes
1answer
82 views

Dynamic multidimensional arrays

My application needs Field objects, which encapsulate 1D, 2D or 3D gridded data. The number of dimensions and their size are known only at run time. Furthermore, I ...
1
vote
2answers
48 views

Storing and loading functions

The class Functions can store/load any functions. It does this by assigning a unique name to every function that gets added. You can then call the function by ...
6
votes
2answers
129 views

An optional<T> implementation

This is an implementation of optional<T> from C++17, it is mostly standard conforming. I'm looking for a review on efficiency, correctness and performance. ...
10
votes
1answer
197 views

Variant class using generic programming

My goal is to learn a bit more about generic programming in C++. So, one of the trickiest things I've heard you can do is creating a Variant class. This took me a while and I needed to read and study ...
0
votes
1answer
72 views

C++ lazy constructor

I'm implementing a lazy constructor in C++. The goal is that for a type T, lazy<T>(args...) returns a callable object ...