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
66 views

Mth to last element

This is a challenge from codeeval Write a program which determines the Mth to the last element in a list. Input sample: The first argument is a path to a file. The file contains the ...
3
votes
0answers
44 views

Quick sort implementations

I made a compendium of different known quick sort partitioning methods, implementations and pivot choosing methods. Any kind of improvements are welcome. Partitioning methods: ...
0
votes
2answers
29 views

Observer pattern implementation

I'm reading Head First Design Patterns and I'm currently reading about the observer pattern. Is what I produced correct? ...
0
votes
0answers
17 views

Building up a function call from the function's arguments [on hold]

I'm attempting to write another FFI for Lua in the same vein as boost.python while learning some template metaprogramming c++11 style. I'm attempting to build up a tuple of function arguments from ...
5
votes
2answers
39 views

Basic OpenGL Renderer class

I made this Renderer class recently, to simplify the user interface of my library's API. I would like to ask advice about the move semantics (copy constructor, ...
2
votes
1answer
37 views

Implementation of Sequence Alignment in C++

Below is my implementation of the dynamic programming solution to the sequence alignment problem in C++11: ...
0
votes
1answer
74 views

Immutable C++ String class

I have project where I will need to create lots of immutable strings. If I am using std::string, which has huge overhead - about 60-70% against ...
11
votes
2answers
114 views

How to speak Brainfuck: for beginners

The following code transforms multi-line input into the the Brainfuck equivalent. One line turns into one program. The resulting programs are split by newlines for readability. Brainf.cpp ...
3
votes
2answers
151 views

Measure execution time of sorting algorithms

I have to measure execution time of certain sorting algorithms being passed as functions in following program. I also do not have to measure it on random container but also on ascending as well as ...
3
votes
1answer
71 views

Detecting cycles

This is a challenge question from codeeval.com: Given a sequence, write a program to detect cycles within it. Input sample: Your program should accept as its first argument a path to a ...
8
votes
2answers
137 views

Yet another OpenGL Shader: the Builder pattern and lifetime management

I've noticed that whenever a shader program class is implemented (from some questions on this site, as well as more reputable implementations), that: The class tries to do too much. Binding to the ...
6
votes
2answers
193 views

Stack implementation with a linked list

Could anyone provide any constructive criticism? I'm trying to get a jump on data structures before classes start. One thing is that I should add a copy constructor and assignment operator. Changes ...
11
votes
4answers
904 views

Binary Search Tree - C++

I'm implementing several data structures in an attempt to learn C++. Below is a binary search tree that I've implemented to learn about pointers, dangling pointers, and memory leaks. I was hoping ...
3
votes
2answers
77 views

Integer to English Conversion

I wrote some code to translate numbers ( for now just positive, up to the 32bit limit ) into English words. Everything works and I'm happy. I searched through the site looking for a comparison code ...
6
votes
3answers
83 views

C#-like properties

I'm studying metaprogramming I figured out a way to implement C#-like properties in C++. This is proxy object that performs a specified function when you try to receiving or assigning values. ...
10
votes
2answers
133 views

OpenGL game engine

I'm making a C++ game engine for entertainment and am using OpenGL to render my stuff. I made a batch renderer that was able to render 50K sprites with 300 FPS (untextured). My old setup that was able ...
6
votes
2answers
113 views

Contact search application

Create a C++ program which will act like contact search app in mobile. For example, if the following contacts are saved in contact list: Massi Pradip Prasad Praveed Raju ...
8
votes
1answer
65 views

AL N*N Tic Tac Toe Game - 2

Base on the previous question: AL N*N Tic Tac Toe Game Here is a summary of improvements: Deleting the Match class for its expensive calling constructor ...
11
votes
2answers
59 views

Unit testing with a singly linked list

To hone my skills with C++11, I'm implementing a singly-linked list based on the requirements I found at this link. I've implemented code that supports the following subset of requirements from the ...
3
votes
2answers
126 views

AL N*N Tic Tac Toe Game

Here is a simple Tic Tac Toe game. I would like to know how I can improve this code further. ...
8
votes
5answers
226 views

RingQueue implementation using std::array

I've recently finished implementing a ring queue based on std::array in C++11. I tried to write the code as if I were going to submit it to the C++ Standard ...
2
votes
2answers
81 views

DailyProgrammer Balancing Words Challenge

I'm hoping for someone to help me use the best practices and further make my code better that I used to accomplish the DailyProgrammer Challenge "Balancing Words". The challenge is to check if a word ...
5
votes
2answers
118 views

C++ 2D shape intersections - template reduction

I've created a short piece of code to determine whether or not various 2D shapes (circles/lines/rectangles) intersect. It was a job interview question, but now it's just about self-improvement. I'd ...
5
votes
4answers
251 views

Sufficient implementation of subset sum for 45 min interview

I am preparing for interviews, and have implemented a solution to this problem from Geeks for Geeks: Given a set of non-negative integers, and a value sum, determine if there is a subset of the ...
2
votes
1answer
69 views

Interview adjacency list graph problems in C++: proper graph implementation

I know this type of question has been asked before. However, my reason for asking it is gaining insight into what is expected in a 45 min interview when asked to implement graph algorithms. I have ...
5
votes
1answer
115 views

C++11 recursive atomic spinlock

Could you please review my spinlock implementation? ...
1
vote
0answers
28 views

Creating class method using macro to accept Visitator for each of their fields

I had a lot of classes that used a macro with listed fields. The macro was used to serialization, more like MSGPACK_DEFINE. I need a substitution of this mechanism, ...
3
votes
1answer
75 views

Hybrid Lock Implementation

I have an algorithm that is painfully slow if I use 'pure' mutexes. That's because most of the critical sections are short and far shorter than the work to sleep a thread. However, it is also slower ...
4
votes
2answers
53 views

Linear cryptanalysis of a substitution permutation network

I was translating a script I had that would automate linear cryptanalysis of SP networks from Python to C++. For those who aren't familiar with cryptography, linear cryptanalysis involves finding ...
5
votes
1answer
90 views

A* algorithm solution to “intermediate space probe” challenge

This code is my solution to this Reddit challenge: Description: NASA has contracted you to program the AI of a new probe. This new probe must navigate space from a starting location to an end ...
7
votes
3answers
101 views

Parallel factorial algorithm using std::thread

This code calculates the factorial of a number on multiple threads. My issue: it is only a little bit faster than the sequential version of it (and I think I know why, I just can't find a way to solve ...
3
votes
3answers
104 views
6
votes
1answer
106 views

Lock-free bounded stack in C++11

Here is a classical attempt to implement a lock-free stack (based on this article). I rewrote it in C++11 and also tried to add memory orders which I would like to confirm to be correct. ...
4
votes
1answer
82 views

Lock-free bounded stack atomics

I was thinking about using very basic bounded (preallocated) stack to keep track of my threads IDs in correct LIFO order. I was wondering if my implementation is thread safe: ...
3
votes
1answer
40 views

Implementation of FastICA in multithreading approach

I am to implement a parallel version of FastICA, so I implemented the serial version of FastICA. Now this is the architectural diagram of how it is going to parallelize. I just coded a basic ...
6
votes
1answer
57 views

Pool allocator for a scripting language parser

At the moment I'm writing a parser and interpreter for a custom scripting language, to learn more about the basic concepts involved and to get more familiar with tools like ...
1
vote
1answer
52 views

JARJAR challenge on SPOJ

I tried this problem and I saw that my solutions was way too slow compared to others. I want to know how I can improve time complexity. A job has been assigned to Jar Jar Binks, it goes as ...
0
votes
1answer
124 views

Rule of 5 - C++11 [closed]

Source/Context: What is the copy-and-swap idiom? Rule-of-Three becomes Rule-of-Five with C++11? The C++ Programming Language 4th Edition June 2013 - Section 17.1 Introduction 483 ...
2
votes
1answer
72 views

Using C++11 move semantics to implement state pattern

I'm implementing a C++ layer on top of the sockets api of the OS (i.e. man 7 socket)1. Tcp sockets go through various states. Using the RAII principle leads to distinguishing the states: ...
8
votes
3answers
258 views

Network programming for an IRC Bot

I'm currently making my first steps into the territory of network programming, using the SFML Network library to simplify things. Later on, my bot shall post new pull requests and changes concerning ...
2
votes
1answer
72 views

Idiomatic iterator for a linear function

A while back, I asked a question about implementing an idiomatic iterator in C++. I've recently revisited the code, and I'm bothered by the duplication in the begin and end iterators. The code goes ...
8
votes
1answer
59 views

Bresenham line drawing implementation

I found myself having to implement Bresenham's line drawing algorithm. I'm looking for feedback on effectivity and code style. Can I reduce the code somehow? ...
3
votes
1answer
55 views

Interval scheduling problem in C++

The problem I attempted to solve is described as: What is the largest subset of mutually non-overlapping intervals which can be selected from I? Where I is a set of N intervals where each ...
8
votes
2answers
97 views

Smart pointer or how not to leak a pointer

Wrote a couple of blog articles about smart pointers. Unique Pointer Shared Pointer Constructors for Smart Pointers So I suppose it time to get the result reviewed. This is not supposed to be a ...
3
votes
2answers
94 views

Ring buffer for audio processing (follow up)

This question is a follow up in regards to the comments suggested in a previous post regarding a Ringbuffer implementation in C++ for audio processing. Ring buffer ...
4
votes
1answer
89 views

Template Method Checker

I have written some template helpers to check if a class has a certain method with a certain signature. The code is based on this answer. I attempted to extend it for generic methods. An important ...
1
vote
1answer
60 views

Modern Opengl GLSL Shader Class

I've finally written my own Shader class. It's a basic implementation based on a tutorial, and it works perfectly. Any suggestions on how to improve, or correct my ...
4
votes
1answer
43 views

Serializable Queue header only library

I was hoping someone could check the library I 'm working on to see if they could give any suggestions. My biggest issue right now is getting tuple to work with more than just the basic types and I ...
4
votes
2answers
60 views

Parsing command input with simple bimaps

I've been playing with a simple toyrobot exercise to brush up some of my forgotten language skills and was wondering if there was a nicer way to implement my main command parsing loop. I think the ...
4
votes
4answers
160 views

First non-repeated character

Challenge description is here need to find the first non repeated character from the string: Write a program which finds the first non-repeated character in a string. Input sample: The ...