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)

3
votes
1answer
39 views

Generate voxel terrain with Perlin Noise

For my chunk generator for my game, it currently uses a triple nested loop, which seems very inefficient. It also seems like I could cut down a lot of code in the function somehow. Does anyone have ...
3
votes
0answers
51 views

Game engine/C++11 software 3D renderer/WebGL library

I am a graphics programmer and was wondering about my code quality. I selected these three examples: Game engine, which uses OpenGL and has a lot of other non-graphics code A 3D software renderer, ...
2
votes
0answers
44 views

Dynamic graph in C++11 with shortest path algorithm

I've been designing a dynamic graph to improve my understanding of C++11. The dynamic aspect means that it could represent the hyperlink structure of a chunk of the internet, with node deletion ...
6
votes
0answers
99 views

C++14 Event System

I've created a simplified event system for C++14. The code is commented, so it shouldn't be hard to read. There's also a simple usage scenario below. It is still a work in progress and uses some ...
9
votes
2answers
82 views

OpenGL shader class

I'm working my way through some basic OpenGL tutorials and have decided to offload the shader loading/compiling/linking to a separate object that I'll use for the remainder of the tutorial material. ...
1
vote
1answer
23 views

getProcID and getProcessHandle functions

I made two functions: one to get process id and the other to get a handle with all access to that process using the process id. I'm looking for help with making these easy to use on all types of ...
1
vote
0answers
56 views

C++ base class for heap awareness

I have a few classes that form a class hierarchy where some objects point to others. In the usual case, I create these object on the stack. In other cases, I need to clone these object to do some ...
4
votes
1answer
52 views

Simple 8 Puzzle - ASCII - follow up

Based on the previous question, I have implemented all suggestions with slight modifications. The game seems fine, are there any further improvements needed in this game? ...
1
vote
1answer
107 views

Aggregate wrapper

Handy wrapper for aggregates to use with emplace*() container's member functions: ...
6
votes
2answers
99 views

std::once_flag and std::call_once implementation

I'm implementing std::once_flag and std::call_once for a particular MinGW build where they are not available, using only stuff ...
3
votes
1answer
46 views

Simple 8 Puzzle - ASCII

I made a simple 8 puzzle which is 3x3 grids unsorted. The user has to move only one number at any direction, which is next to an empty tile. If the user sorted numbers, he/she wins the game, otherwise ...
3
votes
2answers
91 views

Fractional knapsack in C++11

I am just picking up C++11 and decided to try some algorithmic problems to get better at it. One such problem is the fractional knapsack problem which can be solved by a greedy approach. The idea is ...
12
votes
4answers
923 views

Rubik's cube timer & scrambler

This uses a linked list to store the data. I used a linked list as it's the only type of data structure that I know currently. Using chrono, I can get microseconds ...
3
votes
1answer
87 views

Minimalist Tree

While working on a small project, I tried to implement a super simple tree class in C++. It supports an arbitrary number of branches from each node. In addition to general comments, my main concerns ...
3
votes
0answers
26 views

Simple Snake Game - Follow-up 2

Based on the previous question, I have implemented all suggestions. Also, I worked a bit in this project to improve it. Summary of improvements: split the code into multiple files as .hpp and .cpp ...
2
votes
3answers
79 views

HackerRank Anagram

I was (yet again!) inspired by a previous question to post some code to solve the same problem. In this case, the problem in question is the Anagram challenge on HackerRank. The basic idea is that ...
1
vote
2answers
41 views

Printing contents of list with indices from other list

I have two lists: L stores some values and P holds values that are indices in the first list that should be printed. Lists are sorted in ascending order. Error-checking can be ignored, and both lists ...
5
votes
2answers
58 views

Dynarray implementation with iterator

So here is an implementation of a dynarray. Many people might not know about it, so here is a reference. Note that I am not trying to write a 100% standard ...
7
votes
1answer
119 views

Attempt at Dijkstra's algorithm

I tried to implement Dijkstra algorithm in C++ 11. Is this a good implementation of Dijkstra algorithm in C++ or not? I have overloaded -= and ...
4
votes
3answers
73 views

Use va_list to format a string

I wrote a function that basically works like sprintf, but instead returns the formatted string (std::string). I haven't worked ...
1
vote
1answer
52 views

Simple Snake Game - followup

Based on the previous question, I have implemented all suggestions. Also, I added new features to the game. Summary of improvements: Implemented smooth movements to snake instead of tile movements ...
3
votes
1answer
70 views

Simple Snake Game

I was working on this game for while and I have made it for education purposes by using SFML. The game works fine but I would like to know how I can improve it. ...
6
votes
1answer
195 views

Change calculator

I likes my use of functions so I'm mostly looking for little things but if you see something tell me :) ...
5
votes
0answers
90 views

Fluid Simulation with SDL

I have always wanted to write a fluid simulation, and with the help of a paper and some StackOverflow users I've got something that works. My goal is to have a program that someone can run right away ...
5
votes
1answer
81 views

Returns all primes p between m <= p <= n

This is my submission for the Prime Generator on SPOJ and it was accepted. Are there any improvements/changes I can make? Input: The input begins with the number \$t\$ of test cases in a ...
10
votes
1answer
91 views

Max element of input iterator range

I came across this SO question on why std::max_element requires a ForwardIterator (as apposed to an ...
3
votes
0answers
44 views

Updatable priority queue

This is an updatable priority queue. In contains an index (implemented as std::unordered_map) which maps a value to its position in the queue itself. The queue is ...
4
votes
0answers
33 views

Heap update generic algorithms

In the standard library, there are no algorithms for element updates. This makes it unsuitable as a queue for a Dijkstra's algorithm, for example. Thus I implemented generic heap update functions with ...
6
votes
1answer
59 views

Simple OpenGL-2D Program

I have created mini-opengl program that draw simple chess board on screen by using SFML windows model only. The program runs fine. The main purpose of this program is to keep it as simple as possible ...
11
votes
3answers
876 views

Safe strcpy implementation with C++

After reading this article, I've decided to take a crack at implementing a "safe_strcpy" function that would remove some of the errors that the author speaks about. Obviously, my ...
4
votes
1answer
62 views

Return row or column from a 2D array

I have a 2D array class that is actually mapped to a 1D vector. For example, to obtain an element at a particular position, the code is as follows: ...
6
votes
4answers
240 views

Simple factory retrieving object by name

Despite the fact that this code works, I would like to know if there's any situation I did not anticipated, and/or if what I am trying to do is some what wrong. -std=C++11 flag needed ...
3
votes
0answers
62 views

Console Command module (in-game console or base for script engine)

I've created a console/terminal command handling module that allows the programmer to bind functions to a command name and later execute them from std::string. What's new is that it handles most stuff ...
11
votes
1answer
96 views

C++11 implementation of Huffman-encoding

This is a c++11 implementation of Huffman-encoding that I wrote as a hobby. My main goal in writing it was to get more accustomed to c++11 and STL in general, as well as stuff like bit-manipulation. ...
5
votes
0answers
41 views

Using the llvm::iterator_adaptor_base

I'm currently working with the LLVM JIT framework. There is some graph I had to implement for internal cost bench-marking. It has cyclic node dependencies, so I have to use ...
10
votes
1answer
137 views

Binary heap performance optimization

I have implemented a binary heap as a exercise in data structures. I realize that I'm missing some useful functions (increase/decrease key for example) but I don't consider them interesting for the ...
6
votes
1answer
60 views

C++11 version of Windows EventWaitHandle

I don't know C++ at all, but for the heck of it I tossed this together because I was talking with someone about C++ and was given the impression there is absolutely nothing quite like the windows APIs ...
8
votes
2answers
350 views

C++ Graph Implementation

My data set is a list of Edges which are passed as a pair of integers. Based on that, I have the following graph implementation for BFS. Could someone please review ...
7
votes
1answer
75 views

Scoped time sink implementation

I have written a little class that is intended to be used to spend unused time in a loop body, sleeping. That is, I have a loop. I want every iteration to take at least X seconds. If the operations ...
8
votes
2answers
268 views

Finding indexes of numbers that sum to a target

I've taken this algorithm question, which is to find the indexes of any two numbers in an array that sum to a given number. It is quite a simple problem to solve. But it is the execution time of my ...
6
votes
1answer
75 views

Converting memset and struct to newer notation

I'm taking this C++ program and am trying to replace some of the older structures like memset (which I don't completely understand) and struct with newer language optimized for C++11. The program ...
6
votes
1answer
289 views

Simple random generator

Based on this question, I have made a simple program to print a sequence of random numbers. The program seems to run fine, but I would like to know if my implementation is correct and how I can ...
5
votes
1answer
54 views

The final word on contiguous iterators

Following the paradigms of SCARY iterators, there should only be a single iterator-type for contiguous iterators per value-type. Here my code for that iterator, working with C++11+: ...
4
votes
2answers
48 views

C++ EventHandler class, invoking & arguments

This is my EventHandler class, which is extremely simple and can be used on lambdas and similar: ...
10
votes
1answer
97 views

Copyable Atomic

I find it pretty annoying that c++11 atomics can't be copied. The reasons for this have been discussed e.g. here and I don't want to argue about them now. However, I find myself repeatedly in ...
14
votes
5answers
2k views

One program using three functions to compare two double-precision numbers

I am currently learning C++ though Bjarne Stroustrup book Programming Principles and Practices using C++. Going through the drills, I am trying to purposefully write efficient and readable code (good ...
5
votes
4answers
131 views

Implementation of cstring wrapper class

I want to have a thin wrapper (low overhead) around c-style string. Also, with some additional features like == and < ...
5
votes
1answer
129 views

Static array wrapper with iterators

This is just like std::array<T, N>. I wrote this for practice. The class is in a different namespace, so the name array ...
2
votes
1answer
75 views

Multithreading fitness calculation of a sequence in a math function

I wrote this program to calculate a value from an energy function from a sequence of 1s and -1s. The problem here is to find the lowest possible fitness for a function (note that this is original ...
3
votes
1answer
85 views

A non-recursive tuple_element<index, Tuple> implementation

This is basically a non-recursive std::tuple_element implementation. Note To make this non-recursive, you must replace ...