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.

Filter by
Sorted by
Tagged with
1
vote
0answers
27 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
302 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
37 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
114 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
26 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
118 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
195 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
791 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
60 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
72 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
71 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
92 views

C++ algorithm to implement multiple operators in one

I have a class called IntMatrix which has 2 fields: ...
0
votes
1answer
64 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
103 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
45 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
51 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
57 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
101 views

Is this C++11 seqlock implementation correct?

My code: https://ideone.com/DZeIZv ...
1
vote
0answers
26 views

ECS implementation cache friendly

I have an ECS implementation I wish to make more cache friendly and I'm stuck on what I should do. Let me first present you with the implementation. ECSManager.h: ...
8
votes
3answers
120 views

Command line based game with players and monsters

I am coding a command line based game with 1 player and 2 monsters. Monster attacks player at specified intervals and player takes input from standard input to attack specific monster. I would like ...
3
votes
0answers
52 views

std::vector<bool> workaround in C++

I've been trying to make an std::vector of boolean values and I got fed up with the specialization. To get around this, I made a wrapper class around ...
1
vote
1answer
66 views

Bubble Sort Implementation | C-ish and Modern C++

For practice purpose, I wrote bubble sort in C++ two styles: C-ish and modern C++ compliant. I would like to have your comments on any point on these implementations. ...
3
votes
1answer
32 views

An implementation of maximum subarray finding algorithm in STL style

I am reading Stroustrup now and I was very impressed with how flexible the STL library is thanks to iterators and generic programming. Along the way, I am also reading Cormen's book and decided to try ...
3
votes
1answer
108 views

Validating Swedish social security numbers (Luhn algorithm and dates)

I've been writing code for some time but never had the need (or opportunity) to write C/C++ code. Did a small project to learn some C++ and would appreciate feedback on code, testing, project ...
3
votes
1answer
75 views

Thread safe reader-writer queue with C++11

Below is my honest attempt to write thread safe queue using C++11 features. Please review it and provide your comments. ...
1
vote
0answers
43 views

Old Style Implementation of Tuple in C++

Recently I was learning about TypeList and its algorithms in C++. When reading about its uses i got to know that TypeList along with the help of ClassHierarchy generators can be used to create Tuple ...
1
vote
1answer
84 views

Basic login system that uses credentials from text file

I was wondering if you'd be able to review my basic login system that uses sstream and fstream? I feel a lot is wrong with it in terms of efficiency. I've included validation such as if a username ...
2
votes
2answers
89 views

Lock-free multi producer logging/profiling, multi file descriptors

I am developing (for fun) a Utilities & Logging library Can someone please help me to improve: Github link Pros Thread-safe, no mutex. Use lock-free ring buffer (the idea is inherited from ...
7
votes
1answer
146 views

Safe new/delete

A student was having problems with memory management so I put together an overload of global operator new and global ...
4
votes
1answer
970 views

Implementing a queue in C++

I'm trying to implement a really basic queue (as an array) in my computer science class and want some feedback on my logic/methodology. the queue is not circular, it just includes the basic functions ...
4
votes
2answers
106 views

Atomic fixed-size parallel std::vector wrapper

I'm in need of a simple wrapper for a fixed-size std::vector that can ensure atomic insertion. Since my only real problem is with atomic insertion and I know ...
5
votes
3answers
470 views

Template Matrix Class: implemented some basic functionalities

Basically I have written a matrix class for addition, multiplication and scalar multiplication. I need your review of the class implementation below in terms of efficiency, memory consumption and new ...
14
votes
4answers
3k views

BigInt class in C++

I made a BigInt class that supports almost all functions an int would. The code seems too bulky and there might be a few bugs lurking here and there. I would like ...
23
votes
11answers
6k views

Find nth Fibonacci Number, using iteration and recursion

I'm a beginner programmer and I came upon this problem which is to find the n​th number in the Fibonacci series. I used to solve the problem using a for loop; ...
3
votes
2answers
164 views

Finding median of sub arrays taking too much time

I'm trying to solve a programming challenge where I have to find the median of given subarrays of an array. I have used std::vector's ...
5
votes
3answers
733 views

Implementing Sample Abstract Factory Pattern using Smart Pointers in C++

Was trying to implement and example code to smart pointer from link. Is it a good practice? To go with all unique pointers or should we use shared pointers in this case? How can i improve this ? <...
3
votes
1answer
70 views

Substitution Cipher: Which One?

I'm a beginner and I have a question (somehow silly and stupid :) ). Today I decided to challenge myself and I came around the challenge that wanted me to create a program that ciphers (or encrypts) ...
6
votes
3answers
199 views

Safe Integer Library in C++

I've designed a single-file safe integer library in C++. It catches undefined behavior prior to integer overflows or underflows and throws the respective exceptions. I intend this to be portable, to ...
4
votes
1answer
146 views

Mathematical Camera class with types of Eigen library

I want to make a camera class with help of the Eigen library. The camera will be used to perform certain calculations or rather the values used to setup the camera will be used later on in multiple ...
2
votes
1answer
138 views

Sales System Calculator

I'm a beginner programmer and I was hoping someone would be able to review my program. Everything has been tested for user validation, error-checking and conforms to the specification with a few ...
10
votes
2answers
1k views

Graph coloring project in C++

I recently had to submit my 12th grade final project in C++, so I decided to make a game engine! That panned out just as you would expect (I am not touching OpenGL until they touch OOP), so I switched ...
1
vote
1answer
60 views

Maximum sum of hourglass in an array

I am solving some questions on HackerRank for practice purposes. This morning I solved one called Maximum sum of hourglass in an array. Given an array: ...
2
votes
2answers
92 views

Dynamic array class in c++

So, as an exercise I wanted to write a dynamic array, like std::vector. I wanted to know if there are any things that could be done better or anything I did wrong. Thank you! ...
1
vote
1answer
46 views

Check if neighbors are active in spatially subdivided voxelization

I have a voxelization that I need to write out to a binary STL file. These voxels are inside a higher-level 3D grid, with each cell in the grid being made up of voxels. Individual cells may or may not ...
2
votes
1answer
67 views

Header only HTTP client library that is a wrapper around CURL

For learning purposes, I wanted to create a header-only C++ wrapper library around HTTP CURL functionality. At the moment the library only implements GET and POST, but I will add other HTTP methods ...
2
votes
1answer
106 views

Fast Stream Formatting Into String

I am trying to find a way to convert printable data types into a string in the fastest way possible. I originally read that a static variable of stringstream that ...
1
vote
1answer
74 views

Car Milage and Cost Calculating System based off menu selections (using a class)

I was wondering if anyone would be kind enough to review my basic c++ program. I'm a beginner programmer so was hoping to get feedback on how well I've used object oriented programming i.e. using a ...
2
votes
2answers
65 views

Find the next empty column on a chessboard [closed]

I was playing around with the "eight queens" problem, just to see how I could use C++ algorithms to write less code. I figured out a way to find the next unused column using ...
0
votes
0answers
49 views

Scheduling threads to run at a particular time

I was wondering if you could please comment on code quality, correct usage of c++17 constructs, stl/c++ compliant api, performance, or anything else that you might find relevant. Also do you think ...
0
votes
0answers
55 views

Merging rectangles

I am looking at some code that merges boxes: ...

1
2 3 4 5
33