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
2answers
159 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
65 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
40 views

C++ Readable serial constant range counter [on hold]

What I am asking here is about code readablity. Consider the following code: ...
4
votes
1answer
58 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? ...
0
votes
0answers
21 views

How do I print out the text file by reading strings and scores? [on hold]

Alright, I will do my best to ask this kind of question. This is a homework assignment, so I gotta learn the hard way. I'm in a class that we are learning C++11. It is basically new to me so I'm ...
8
votes
1answer
87 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
49 views

any that can hold arrays

I've tried to make a better any than before: ...
1
vote
0answers
17 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
20 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
50 views

Compile Time Constant Map

I have implemented this compile time map as a way to learn templates and constexpr classes: ...
6
votes
2answers
72 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
20 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
76 views

Text-based Snake game on Window

How can I improve this game? ...
3
votes
0answers
29 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 ...
3
votes
1answer
42 views

Copy arbitrary number of bits at arbitrary offset from buffer to another buffer

I have just written a function copy_lowbits_off to copy any number of bits (not bytes) from a source buffer to a destination buffer. The function also supports ...
2
votes
2answers
86 views

Text-based Tetris game CRTP 3

Previous question: Text-based Tetris game CRTP 2 Summary of improvements: Fixed Issues preventing the code from compiling on Clang Implemented helper class ...
2
votes
1answer
71 views

Multiply vector elements by a scalar value using STL & Templates

I wrote a small scientific simulation where I wanted to manipulate vectors with the same kind of functionality that python's numpy vectors use. Namely, I wanted to be able to add vectors together, ...
5
votes
0answers
80 views

Graph implementation adjacency list 2.0

Version 1: Graph implementation adjacency list 1.0 Please note the following: All edges are directed A user of the class Graph shall never be able to aces an object of type ...
1
vote
2answers
67 views

A simple gradebook using structures

I have this basic question about the efficient way to sort user-defined object. It can be done in many ways, but most of sorting algorithms at best cases is \$O(N)\$. I have come up with a fair ...
6
votes
4answers
441 views

Recursive binary search tree - follow-up

This is a follow-up to Recursive binary search tree changes: Used raw pointers rather than std::unique_ptr const correctness Made variable names more beautiful implemented at() How can I improve ...
4
votes
3answers
361 views

Preorder, inorder, postorder for tree in C++11

Please review my code for preorder, inorder and postorder of a tree. I am using C++11 (or wanted to use), so let me know if anything is deviating from the C++11 standard. ...
4
votes
1answer
60 views

C++11 lock free collection similar to std::forward_list [closed]

I'm new to explicit memory ordering, and any kind of thread safety is hard to implement right to begin with. Please let me know if you see any problems, or have suggestions for improvement. Written in ...
2
votes
4answers
142 views

Java vs C++ (JAVAC)

Here's the problem for Java vs C++ (JAVAC): Java and C++ use different naming conventions. In Java a multiword identifier is constructed in the following manner: The first word is written ...
1
vote
1answer
40 views

Collection of sorting types

A collection of sorting types as following insertion, radix, selection and heap sorts. Is my implementation correct for them? ...
5
votes
2answers
131 views

Speed optimization for block XOR

In code I'm currently maintaining, there is a need to do very many repeated XOR operations of blocks of memory. The block size in my case is always 16 bytes. Because the code is executed very ...
4
votes
3answers
453 views

Recursive binary search tree

How is my usage of std::unique_ptr() and std::move()? How can I improve this code? ...
6
votes
1answer
609 views

Implementing a C++11 raw string class

I'm trying to implement a RawString class that conforms to C++11: ...
2
votes
0answers
20 views

Pretending packaged_task is copy constructable [migrated]

I've been looking for a workaround to the problem of type-erasing a std::packaged_task using std::function. What I wanted to do ...
4
votes
1answer
41 views

C++11 class similar to .Net's ManualResetEvent, but without the ability to “reset”

The goal is to block all threads that call WaitOne(). When Set() is called, those threads continue. Any calls to ...
3
votes
1answer
68 views

Quicksort - follow-up

This is a follow-up to Quicksort function Like the previous code, this does not optimize for containers with large numbers of duplicate elements. How can I improve this code, particularly with ...
7
votes
5answers
755 views

Simple server to manipulate priority queues

In a few months I'll work on a C++ project that could span a year or two. I've a strong C background and for the usual reasons I always chose C over C++ (please forgive me). To extend my capabilities ...
4
votes
0answers
36 views

Simple wrapper class for Win32 console

This is based on a library called Consoledefender V 3.3. I made a minimal class for personal usage based on this library by using C++11. It actually takes user input and prints it back on the console ...
3
votes
1answer
78 views

Quicksort function

I made a quicksort implementation based on this code. Please review my C++ version. ...
1
vote
0answers
36 views

Reversing the “words” of a container with a bidirectional iterator

I posted another snippet of code a few weeks back when I started learning C++. Here's my second try now that I have some time to play with this again. The goal is to write a generic algorithm for ...
2
votes
0answers
32 views

Proxy pattern for supporting '… = ob[idx]->someObjMember = …' type access

I've finally got a working Proxy pattern. The original task is presented here. My test case is on coliru. It appears to flow through the correct pathways, however I am grateful for feedback and ...
3
votes
1answer
66 views

Queue with std::vector

How can I improve this code? ...
2
votes
0answers
65 views

Text-based Tetris game with CRTP - follow-up 2

Previous question: Text-based Tetris game with CRTP - follow-up Summary of improvements: Fixed issues preventing the code from compiling on Clang Implemented override specifier Fixed single letter ...
2
votes
1answer
136 views

Graph implementation adjacency list 1.0

Please note the following: All edges are directed Removal of edges/nodges is not implemented yet A user of the class Graph can never (hopefully) access a ...
7
votes
2answers
93 views

Converting GTA Vice City ADF audio files to MP3

I wrote a tiny command line tool that converts ADF audio files of the Grand Theft Auto - Vice City game to MP3 files that can be played outside the game. The ADF file format stores the game ...
2
votes
1answer
72 views

Pointer handle - absolute follow-up

This is a follow-up to: Pointer handle - follow-up Improved pointer handle Pointer handle with some runtime checking Please review my pointer class. ...
4
votes
0answers
81 views

Representing arithmetic in Rust or C++

I need a method to represent basic arithmetic to help me better understand context-free grammar, so I wrote these. Am I writing it the right way? Is there anything that can be improved? Rust ...
7
votes
3answers
626 views

Dining philosophers problem in C++11

Is this implementation correct? Do you find any threading problem? Also, what parts of the code can be changed to be more C++11-ish? ...
4
votes
2answers
62 views

Pointer handle - follow-up

This is a followup to: Pointer handle with some runtime checking Improved pointer handle Please review this pointer class. ...
6
votes
1answer
62 views

Factory template method for generalized functors

(A quick note on terminology: I use 'generalized functor' to refer to a functor that can be initialized from any callable entity, similar to the definition from Alexandrescu's Modern C++ Design. I use ...
3
votes
1answer
118 views

Text-based Tetris game with CRTP - follow-up

Previous question: Text-based Tetris game - follow-up - final Summary of improvements: Implementation of a Drawable class Separate functionality, input moves to ...
2
votes
1answer
58 views

Improved pointer handle

Please review my improved pointer class. ...
3
votes
0answers
64 views

Text-based Tetris game - follow-up - final [closed]

Previous question Text-based Tetris game - follow-up 2 Summary of improvements: Removed unnecessary functions print() and ...
10
votes
3answers
354 views

Mutable String Class

Here is a String class that I've made for fun in my spare time, for myself. I have a few concerns about it, and am considering going immutable or a mix of the two ...
3
votes
3answers
84 views

Radix sort with C++

At first the input array is traversed and for each number the lsb is found. Then the number is put into appropriate bucket according to it. For example for an input array { 123, 45}, at first 123 will ...
4
votes
1answer
47 views

Vector implementation

This is a C++ Vector that I've made for the pleasure of it. It was made on a whim and is not related any school assignment or anything alike this. This Vector does ...