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
0
votes
1answer
60 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
85 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
39 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 another ...
-2
votes
1answer
46 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
44 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
84 views

Is this C++11 seqlock implementation correct?

My code: https://ideone.com/DZeIZv ...
1
vote
0answers
19 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: ...
5
votes
1answer
36 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 ...
2
votes
0answers
45 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
62 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
99 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
56 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
41 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
77 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
85 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
140 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
951 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
87 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
445 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
5k 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
642 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
68 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
189 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
128 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
133 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
56 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
89 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
63 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
78 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
73 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
64 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
48 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
54 views

Merging rectangles

I am looking at some code that merges boxes: ...
3
votes
1answer
60 views

Timer for scheduling tasks in C++11

I have made a simple Timer class used for scheduling tasks. While defining the interface, I have followed the interface of a ...
4
votes
0answers
65 views

Tic Tac Toe with different level AI

I've already created a code in python here with almost the same logic: Tic-Tac-Toe with changeable board size (Part 1) Tic-Tac-Toe with changeable board size (Part 2) Here's the code in C++. As I'm ...
2
votes
1answer
98 views

Prim's Algorithm - Minimum Spanning Tree

I have implemented Prim's Algorithm from Introduction to Algorithms. I have observed that the code is similar to Dijkstra's Algorithm, so I have used my Dijkstra's Algorithm implementation. Please ...
2
votes
1answer
253 views

Multi-threaded LinkedList Implementation

I am learning to write a multi-threaded linked list class implementation with basic functionality such as push to front or back, ...
1
vote
1answer
111 views

How well does this ECS implementation follow these principles?

I'm currently learning about Entity-Component-System architecture Data-Driven design as a way to counter bad OOP design and optimize data fetching as a CPU friendly operation. I'm trying to write a ...
2
votes
2answers
90 views

Operator overloading in C++ to manage playlists of music

I've built this little C++ program just to take some rust off my coding skills since it's been ages since the last time I coded something. The purpose is to organize my music, so I've built the ...
3
votes
1answer
115 views

A runtime benchmark for multiple programs using the Python subprocess module

I would like feedback on my benchmark script, for use on Linux. What's another method for benchmarking that might be better/easier? Overhead I've found that ...
7
votes
3answers
319 views

Optimizing Conway's Game of Life in C++

How could I further optimize my implementation of Conway's Game of Life? And how would you critique my current strategies? I'm taking a C++ optimization class, the deadline has passed and my ...
1
vote
0answers
27 views

Overloading both for (non) constant access [closed]

I'd offer a couple of iterator accesses to the class member, both constant and non-constant. I came to the following solution, but it seems to me far more verbose than needed. I'd like somehow to ...
4
votes
0answers
201 views

Polymorphic deleter for unique_ptr

There is a basic difference in the way C++ manages the deleter for std::unique_ptr and std::shared_ptr, mainly for allowing ...
10
votes
1answer
505 views

C++ Standard-Thread Threadpool

I have written a small and simple ThreadPool class for rather simple multithreading applications. The Threadpool class manages ...
5
votes
1answer
141 views

Wu-Manber algorithm for multiple pattern matching in C++

I'm trying to implement the Wu-Manber algorithm (http://webglimpse.net/pubs/TR94-17.pdf). From my understanding, the algorithm basically does string matching using a hash table-based approach with ...

1
2 3 4 5
33