Questions tagged [c++11]
Code that is written to the 2011 version of the C++ standard, sometimes known by its pre-publication name of "C++0x". Use in conjunction with the 'c++' tag.
1,678
questions
1
vote
1answer
39 views
generating stochastic coloured noise for many oscillators
I have a system of n oscillators which oscillate with time. To each of these oscillators I am adding a fluctuating coloured noise term with a different seed for each oscillator. Here is my code for ...
1
vote
1answer
35 views
Priority scheduling algorithm using std::vector
I'm learning priority scheduling algorithm and trying to implement it using std::vector. But the current performance of my code that's partially implemented is not ...
9
votes
1answer
1k views
Deck of Cards written in C++
I created a deck of cards that I used in a BlackJack game. I stripped out my black jack logic and left just the Deck, card and minimum dealer.
The deck class is there because I want to create ...
3
votes
1answer
33 views
Random index generator in C++
I have a training dataset from which I want to draw samples in a random fashion such that all samples are used before getting randomly shuffled again. For this reason I implemented a simple random ...
0
votes
1answer
39 views
C++ Error/exception handling [closed]
I know the following code are horrible, so I'd like a review. Criticism are welcome. I want to know what went wrong, and how I can avoid the same mistake in the future.
Version 1
...
7
votes
1answer
130 views
Modular synthesizer framework for C++
While working on a much more complicated audio application, I was thinking about modular synthesizers, and whether it could be made simple to build a C++ application that implemented a modular ...
2
votes
1answer
58 views
An Implementation of Two Dimensional Plane as Monochromic Image Container with std::unique_ptr in C++
I am trying to implement a monochromic image container with std::unique_ptr.
The example usages
The example usages is as below.
...
13
votes
5answers
2k views
Simple dataset class in C++
As part of my training, I implemented a dataset class in C++ that allows me to create synthetic datasets to get more familiar with features that C++ offers such as object oriented programming.
This ...
3
votes
2answers
180 views
My String Class
Here's my very basic String class. This is my first attempt, to try to design and write a basic String class in C++, without using the absolute new features provided by newer C++.
...
8
votes
2answers
352 views
Using c++11 random header to generate random numbers
I'm new to programming. I have a question regarding the usage of c++11 random header to generate random numbers.
I tried to learn it, but was unsuccessful.
Recently, I've tried the following approach ...
1
vote
1answer
38 views
Find the next number with all different digits, and no 0 or 2
Task
Input - integer number (year)
Print one number - the next year, in which all digits are pairwise different, and there are no digits 2 and 0. If there will never be such a year, print ...
3
votes
1answer
79 views
Grade Calculator (New OOP Version from one previous)
I'm trying to develop an OOP way of thinking. I was hoping someone would be kind enough to spare some of their valuable time to review my Grade Calculator OOP program. As always, I'd like to know what ...
4
votes
1answer
254 views
Noughts & Crosses UML Class Diagram
I was told I need code in order for someone to review my UML Class Diagram for my Noughts and Crosses console application. I would like to know if it's intuitive, whether you could make a program ...
3
votes
2answers
793 views
Tic Tac Toe (New OOP Design)
Would someone be able to review my latest OOP design of my Tic Tac Toe / Noughts & Crosses program? I’d like to know what I’ve done well and whether I could improve the OOP Design. Many thanks in ...
1
vote
2answers
112 views
Loan System Calculator
I would really like feedback on this Loan System Calculator. My goal is to get better at OOP design and would like to know if I've done a good job in making this scenario OOP? Could I have structured ...
5
votes
1answer
52 views
wrapper class for random access iterator to hide template method implementation from header file
I have a set of template functions that have itrator types as template parameters, so can be used with any kind of iterators. std::find can be a good example.
Also ...
7
votes
1answer
61 views
External sorting with async read and write
I wrote this code for a home task, and received some negative feedback. Though I really appreciated the reviewer, but I disagree when he said I use auto disorderly, ...
3
votes
2answers
88 views
Noughts & Crosses (Tic Tac Toe) OOP Design
I was wondering if someone could review my object oriented design for my Noughts & Crosses program. Yesterday I posted a procedural version and now I've done an OOP version.
Can someone tell me ...
1
vote
2answers
101 views
Either monad in C++11
I'm using C++11 with https://github.com/SmingHub/Sming. It has no support of std lib or exceptions. I wanted to use Either monad ...
6
votes
1answer
106 views
6
votes
4answers
667 views
Tax Calculator (using OOP techniques)
I was wondering if you'd be able to review my basic Tax Calculator that incorporates OOP techniques. I'd greatly appreciate it if you didn't mention about my variable naming convention i.e. Hungarian ...
7
votes
2answers
316 views
Doubly Linked List Data Structure ADT in C++
I'm trying to implement a Doubly Linked List data structure in C++. Please give me suggestions on how this code can be improved. Try to remain in C++11 because that's what I know atm.
...
5
votes
1answer
86 views
C++ Queue Circular Array Implementation
I'm trying to implement a queue data structure in C++ using a circular array.
Please give recommendations on how I can improve this code.
Also, is my array growth strategy good? I'm doubling the array ...
7
votes
2answers
459 views
Validating ISBN-10s, with or without dashes in C++11
Description
A regex-based method of validating ISBN-10 as strings. Can be digits (or 'X' at the end) only, or with dashes, according to those of English-speaking publications (which are defined by the ...
5
votes
3answers
369 views
Personal Finance Management Tool (OOP version)
CodeReview Community! I was hoping you'd be able to review my basic OOP program. Last year I did a strictly procedural one and now I’ve incorporated OOP techniques. Ignore the commented out piece of ...
11
votes
5answers
2k views
Grade Calculator (using OOP techniques)
I was wondering if you'd be able to review my basic C++ Grade Calculator I based off the following scenario. I would like to know what I've done well vs what I haven't done well. Many thanks in ...
4
votes
1answer
93 views
Kernel Interpolation C++
Purpose of this program is to calculate the velocity of
ng = nxnynz particles at the Lagrangian points from the values
at regular grid nodes. How can i speed up this calculation?
I hope to receive ...
5
votes
3answers
93 views
A FIR filter using Modern C++ features
I'm diving into "modern CPP", with wide usage of templates and containers,
So I started with FIR filter.
In signal processing, a finite impulse response (FIR) filter is a filter whose ...
4
votes
3answers
145 views
Calculation of Energy Spectrum using C++
My purpose is to calculate the energy spectrum of three-dimensional turbulent flow from three velocity components. The calculation is too expensive. Therefore, I hope the calculation time can be ...
4
votes
1answer
77 views
Const wrapper for iterator
Edit: added clarification for why I want this, and updated the code since I don't have any answers yet
I have a C++11 array-like class which (can be) a wrapper around a random-access iterator. Index-...
6
votes
3answers
114 views
C++ WAVE file reader: library-like structure, safety, readability
Introduction
I have released a small a WAVE file reader with a mutex/lock-based caching mechanism, as a header-only library. The general purpose of the library is to read WAVE files into floating ...
3
votes
2answers
58 views
Using Token Bucket to rate limit function calls
This program is my attempt at solving the below problem:
We have a function which is going to be called by multiple threads. The problem is to find a way to limit the number of times this function is ...
2
votes
2answers
133 views
Reactor pattern in modern C++. Please comment on coding improvements to be done
The reactor possesses its own thread to wait for messages in an event loop.
Users should be able to start or stop the reactor at any point. These two operations are not required to be thread-safe.
...
6
votes
2answers
322 views
Templated palindrome
I'm trying to implement a palindrome check for each element in a vector and return a vector with only the palindromes. This should work for different type .e.g strings int vector of ints.I have done a ...
2
votes
0answers
41 views
Producer consumer with shared buffer in C++11
My C++ knowledge is outdated and I'm trying to learn about C++11 threading. I'm working on a SoapySDR driver where the client acquires a buffer it wants to write to and the hardware transmits from ...
6
votes
1answer
117 views
Manage lists of executable id
I need to manage lists of executables Id. Each executable belongs to a capacity (obviously the list of capacities in the code is just an example).
For every capacity we need to be able to find the ...
2
votes
0answers
27 views
AEC-to-WebAssembly compiler
Now that my new compiler is capable of compiling programs such as the Analog Clock in AEC, I've decided to share the code of that compiler with you, to see what you think about it.
File ...
4
votes
1answer
190 views
Doubly-linked list with iterators
Writing a double-linked list seemed like a good practice for understanding it. I tried to fix all the errors that were pointed out to me in the last question, as well as add new functionality. In ...
6
votes
2answers
239 views
A proxy replacement for getters and setters
Have you ever written proxy objects, instead of using a setter and a getter method? In that case, I'm interested in your opinion on the following design for a templated proxy:
...
8
votes
3answers
800 views
Optimizing a linked list
I wrote a linked list class and don't know how to optimize it, please suggest some ideas for optimizing and fixing possible memory leaks.
...
2
votes
1answer
68 views
C++ reactor bad implementation
folks.
I have recently started writing software using Modern C++ 11-14. I have been developing software for more than a decade and just wanted to broaden my skillset. I am practicing building some ...
2
votes
0answers
78 views
C++ threaded task manager
I've been writing a little task manager in C++ in my spare time. It's also the first time I am posting here for a review, I hope someone can spot any mistakes.
There's still a lot to implement and ...
5
votes
1answer
81 views
Multithreaded console-based monster battle with earliest-deadline-first scheduler
In working on this answer it occurred to me that it might be interesting to further expand the idea.
The game
This is an extremely simple (and boring!) text-based game that creates a few monsters ...
3
votes
1answer
94 views
C++ algorithm to implement multiple operators in one
I have a class called IntMatrix which has 2 fields:
...
0
votes
1answer
73 views
Implementing a binary search tree using std::unique_ptr
I have implemented a binary search tree with 2 operations to begin with. I have tried to implement it using the best practices I could think of. Overall, I am happy with the implementation. But, I ...
4
votes
1answer
151 views
Resource management classes in C++ game
This is a part of simple sfml C++ game, but I think neither the library nor the language is that much crucial here. I am mainly worried about the design.
I have a class template ...
1
vote
2answers
59 views
sleepless timer that does not lose time and handles spurious wakes
I have written a timer class.
Here it is in all its "glory" with some functions around it to test it:
https://rextester.com/LQSXUA43758
Below is the class on its own, note it also relies on ...
-2
votes
1answer
55 views
emplace_back is faster than allocate once + move in c++11? [closed]
I have two fuctions:
f2 - first allocate memory , then move data.
f - deallocate + move = emplace_back.
I am trying to understand what is faster and better to use in terms of performance and code ...
1
vote
0answers
139 views
Own implementation of C++ std::string_view
In order to improve my C++ skills I started doing some toy projects, one of them being my own std::string_view implementation. This was my first time implementing a std library. I'm pasting the code ...
2
votes
1answer
110 views