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
34 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
60 views

Basic Login System That Uses Credentials from Text File

Hi Code Review community. 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 ...
2
votes
2answers
79 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
131 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
929 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
63 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
430 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 ...
12
votes
4answers
2k 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 ...
22
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
162 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
593 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
64 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
184 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
120 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
40 views

Maximum sum of hourglass in an array

I am solving some questions on Hackerrank for practice purposes. I solved this morning called Maximum sum of hourglass in an array. Given an array: ...
2
votes
2answers
78 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
59 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 ...
1
vote
0answers
54 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
63 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
47 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
52 views

Merging rectangles

I am looking at some code that merges boxes: ...
3
votes
1answer
49 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
61 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
92 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
147 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
87 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
79 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
95 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
236 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
26 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
147 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
487 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
117 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 ...
4
votes
2answers
83 views

Random line remover from file

This asks the user for the file name and the number of lines they want to remove. It then stores each line into a vector. A dynamic array is used to hold the random line numbers (generated by random ...
3
votes
1answer
161 views

Consistent and extendable way to store data for session

I am making session store which will store some data and read some, This session store can store multiple data( SessionInfo) to the map. Data Structure ...
4
votes
1answer
73 views

Generating words sounding similar to the ones given in a wordlist — Core program only

This topic is about the same project as this previous one. I think posting the full project was a bit too much, so here I post again only three functions, which are the core of my program, with a few ...
1
vote
2answers
113 views

Container of data structure: a better solution to an interview task

A shipping company has a warehouse of Containers. Basically, a Container is a data structure with the following fields: price commercial campaign id a list of possible shipment countries (empty list ...
2
votes
1answer
66 views

Token class implementation

I have implemented Token and FieldToken classes as part of my project and would like to hear some suggestions for improvement. ...
0
votes
1answer
78 views

Insert elements into a map container

I am inserting elements into the map container. For this I am using the same statements multiple times in the below function. Is there any way I can write a generic function for this? So that even at ...
3
votes
1answer
57 views

How to optimize the code snippet which has several calls to find method that is to read files and load them into the map?

I wrote a functionality to read files and load them into the map m_fileParams. Then I am searching the specific keys in the map container using ...
1
vote
0answers
31 views

Limit framerate [closed]

I have made this class. Not sure if there is anyway to make it better. It seems to work alright half the time, but other times frames jump up higher then the set limit around 30frames more if i set it ...
2
votes
0answers
32 views

C++ Sql-like base operating on csv files

I implemented very constrained trivial implementation of sql querries operating on user files (in csv format). Where possible i tried to use modern C++ features. The fancy goal is to serve MySql ...
3
votes
1answer
70 views

Multithreading Ticket class to wait for parallel task completion

I've implemented a "Ticket" class which is shared as a shared_ptr between multiple threads. The program flow is like this: parallelQuery() is called to start a new query job. A shared instance of ...
4
votes
1answer
56 views

Reading from a stream but reserving N bytes at the end of stream

What I'd like to do is read data from a stream (like ifstream::read), but reserve N = 4 bytes from being returned. The last 4 bytes of the stream are not part of the data itself, but are metadata. In ...
3
votes
1answer
100 views

Stereo image matching implementation in Halide

The authors of this paper compute support_points of a 900×700 image in 118 ms. I have implemented their algorithm below in Halide. In my algorithm, the nested for loops over length and width iterate ...
3
votes
1answer
112 views

Producer consumer with threads and using boost ring buffer

I have two threads, one is the producer and other is consumer. My consumer is always late (due to some costly function call, simulated in below code using sleeps) so I have used ring buffer as I can ...

1
2 3 4 5
33