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

Interval map over std::map

I've got this test assignment about half year ago. Feedback was "your solution is almost correct, but not superior" without any details. I still don't know where the problem is. I think there should ...
-4
votes
0answers
18 views

i made beginner C++ tic tac toe program [on hold]

It has some problems where I actually print the grid on the screen. Someone please help. Here is the code: ...
2
votes
0answers
42 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
226 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
49 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 ...
0
votes
0answers
25 views

Push-relabel with gap heuristics [on hold]

The following implementation of push-relabel with gap heuristics seems to work in my test cases. However, it fails to be accepted at an online programming problems platform ("wrong answer"). I was ...
5
votes
1answer
97 views

C++11 recursive atomic spinlock

Could you please review my spinlock implementation? ...
1
vote
0answers
26 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
59 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 ...
-1
votes
0answers
36 views

Codeforces problem set 556B: Case of Fake Numbers [closed]

This is the problem I am working on! Note: This is not a competition, just a problem set. So this is my code. The compiler I am using is GNU C++11. This code runs fine with all the test cases ...
4
votes
2answers
49 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
55 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 ...
6
votes
3answers
73 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
2answers
78 views
6
votes
1answer
82 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
80 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
37 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
50 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
44 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
118 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
64 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
243 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
68 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
56 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
53 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
94 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
87 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
87 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
47 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
40 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 ...
2
votes
2answers
51 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
3answers
134 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 ...
1
vote
2answers
54 views

Parse strings and respond

I'm doing some exercises from another good website aimed at a similar problem - exercism.io, and my 1st C++ problem was to pass a certain test suite. Here is the README for relevant information: ...
5
votes
1answer
68 views

Thread-Safe Variadic Printing Function

Printing to stdout is thread-safe in many systems when using printf or std::cout, but not in ...
4
votes
1answer
103 views

Project Euler: Problem 22 (2 versions)

I wrote 2 versions of problem 22 on Project Euler: Using a text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value ...
7
votes
1answer
127 views

Continuation Implementation in C++11

While playing with the concurrency features in C++11 I noticed that there wasn't any support for continuations. I wanted to develop something similar to Tasks in The Parallel Patterns Library (PPL), ...
1
vote
1answer
73 views

A binary tree , its copy constructor and assignment operator

I implemented a binary tree in the following code. Its node's copy constructor and assignment operator should copy itself and all its descendents. Similarity a node's destructor should delete itself ...
5
votes
1answer
110 views

Linear algebra module

I'm working on a linear algebra module to improve my knowledge with mathematics and, because I'll need a lightweight linear algebra module for my future work with Vulkan! I tried to keep a blas-like ...
1
vote
2answers
146 views

Implementation of unique_ptr and make_unique for aligned memory

I am working on a version of std::unique_ptr and std::make_unique for aligned memory. The purpose of this is vectorization, ...
6
votes
1answer
85 views

Lock-free, multiple consumer, multiple producer queue

I'm implementing a lock-free, multiple consumer, multiple producer FIFO queue/pipe as an exercise in thinking about atomicity in operations. My main concern is correctness of operation, my second ...
4
votes
1answer
114 views

Lockless multi user, multi consumer FIFO queue using C++11

One of the features that is missing from C++11 are lockless queues. Therefore I have decided to write one myself. A few remarks: I know the code isn't technically lockless. However the lock is only ...
1
vote
1answer
52 views

Casting between types for shared_ptr

I'm implementing an Entity-Component-System. Basically, an entity is a wrapper around an ID, a component is just a POD struct, and a System is a class that does work on components corresponding to the ...
2
votes
1answer
51 views

Recognising and comparing poker hands

I wrote a little program that recognises poker hand combinations and compares hands if the ranks of both hands are the same. I had tested my program on possible combinations for each rank and the ...
3
votes
2answers
142 views

FIZZ BUZZ -challenge program with adjustable intervals

This is again a solution to the codeEval challenge #1. It was accepted by codeEval, but please let me know if I can improve it anyway somehow? ...
2
votes
0answers
45 views

Serialize/deserialize a vector using insertion/extraction operators

I've never serialized a structure to a file before in C++, so I'm looking for critique on my first try at it. My main concerns are: It uses the streams space-delimited behavior. If a ...
5
votes
1answer
72 views

Single LinkedList using smart pointers

In order to learn C++11, I propose to myself implement a simple single linked list using smart pointers. The idea was to cover the basic operations without leave any memory leak. I came up with a ...
3
votes
3answers
124 views

Right triangle side length calculation

My code compiles and executes. I would like to hear any comments or suggestions pertaining to my use of C++. ...
2
votes
0answers
101 views

A map class based on an AVL tree

Here's an implementation of a class which is similar to std::map, but it's not a complete/identical implementation. I know C pretty well, but am a beginner with ...
3
votes
1answer
67 views

Necklace counting problem-with consecutive prime constraint

This is codeEval challenge to count the number of chains possible to make with beads holding numbers. Constraint is sum of the consecutive beads of chain should be a prime number. The standard ...
3
votes
2answers
67 views

Printing all the permutations of a string in alphabetical order-ver1.1

I adapted most of the suggestions from answers for my previous question Printing all the permutations of a string in alphabetical order to rewrote my solution again. Please let me know any more ...