Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++17]

Use when the code in question assumes at least C++17 compliant compiler.

0
votes
0answers
40 views

Static bounds tensor

Basic tensor class with static bounds. I want to get this done properly, because plan on using this on the GPU in the future. This also means I cant use any STL containers. Speed is pretty important. ...
1
vote
2answers
41 views

Generic (Multi)SkipList adapter class

Today I have written my first implementation of a SkipList (on top of a std::vector), because I was tired in using ...
2
votes
0answers
35 views

Creating an array of distinct objects with an identical method that can be evaluated (mapped) at compile-time (constexpr)

In a ray tracing project that I'm trying to make compile-time (constexpr) for fun and challenge, I've run into a bit of an issue: I have an object (intersection) that needs to refer to one of a group ...
4
votes
1answer
55 views

Generate multi dimensional maze with borders and fixed degree on each node type

IMPORTANT: giving too big combination of node count and edge/neighbor count can overflow your RAM and swap file very quickly, thus I recommend staying below 500 on node count and below 50 on neighbor ...
4
votes
0answers
33 views

Modular graph searcher

some words in forehand: Unfortunately this post is very long, thus I decided to put the whole and compilable code into an online compiler. The link is at the end of this post. In the last few days I ...
3
votes
0answers
63 views

Console based Vocabulary Trainer Version 2

After a long break I took the suggestions from Console based Vocabulary Trainer and reworked the Trainer. It contains of the following parts Vocabulary.h/cpp: Save and read vocabulary from/to text ...
3
votes
1answer
37 views

Generic pixel class to seamlessly alpha-blend and convert between different pixel structure layouts

Does what it says in the title. I just finished this and wanted to share with someone. Looking for possible optimizations, bugs (most of it is tested to work) or any constructive criticism. ...
10
votes
1answer
176 views

Displaying programming languages on a timeline

I did the following two exercises in Programming: Principles and Practice Using C++ (2nd Edition), by Stroustrup, which build upon each other: From Chapter 22 (Ideals and History), Write a ...
3
votes
1answer
83 views

Cleaning a file / Word Query GUI (FLTK)

This is a follow up of Cleaning a file / Word Query I incorporated the suggestions from the anwers there and turned the Word Query Programm into a GUI. For that I used the Support code of the Book ...
7
votes
3answers
185 views

The perfect function alias

For many years, I have waited for function aliases in C++. They still aren't here. I've been using macros to generate wrapper functions. This is my best attempt at the perfect function alias: ...
7
votes
1answer
97 views

Peter Norvigs' lis.py in c++17

I wanted to try convert Peter Norvigs' Python Scheme interpreter to C++. I had tried this a few years before and failed abysmally but I saw that the latest C++ standard includes several features ...
7
votes
2answers
124 views

Cleaning a file / Word Query

In a followup this application was turned into a GUI using FLTK: Cleaning a file / Word Query GUI (FLTK) I did the following two exercises in Programming: Principles and Practice Using C++ (2nd ...
5
votes
1answer
118 views

C++ thread pool class

I have addressed the critique for this post and resubmitted it for iterative review; C++ multithread pool class. Class for creating thread pools with the latest C++ standard. Currently C++17 and C++...
4
votes
2answers
105 views

C++ for_each_adjacent

I was watching a C++ Talk and he showed some code for a basic for_each_adjacent. I took the base concept and improved it a little bit, I am wondering if i could have any feedback. It automatically ...
5
votes
2answers
88 views

Move friendly merge sort - follow-up

This is a follow up to this question. I'm only interested to see if this is implemented correctly for move-only types. ...
1
vote
0answers
38 views

Excercise from PPP Order class

I did the following two excercise from PPP by Stroustrup: Define an Order class with (customer) name, address, data, and ...
6
votes
0answers
120 views

Hunt the Wumpus GUI (FLTK)

I used the code from the text based hunt the wumpus game discussed here: Text based game “Hunt the Wumpus” Version 3 to create a gui Version based on excercises from PPP by Stroustrup. For the GUI i ...
9
votes
2answers
186 views

Modern C++ singly linked list

This is a rather minimal (though fully functional) implementation of a singly linked list. It supports \$\mathcal{O}(1)\$ front insertion and deletions, as well as \$\mathcal{O}(1)\$ random insertions ...
4
votes
1answer
210 views

Travelling salesman problem using genetic algorithm in C++

I have implemented travelling salesman problem using genetic algorithm. Since project is not so small I will give short introduction. GeneticAlgorithmParameters - ...
4
votes
3answers
96 views

Iteration over “zipped” tuples (for_each_in_tuples)

I want to implement for_each_in_tuples that takes a functor and one or more tuples of the same size and applies this functor to <...
3
votes
2answers
84 views

Disassembler for intel 8080 v2

As many suggestions were given for the code I posted here, I decided to show you the new version for review. I Removed the OpenCatalog class, ...
10
votes
2answers
145 views

Disassembler for intel 8080

I have written a disassembler for Intel 8080, able to translate binaries into opcodes and parameters. Sorry for posting so much code, but everything posted here is useful for the understanding of the ...
5
votes
2answers
62 views

Iterable object on set of ids

For some of the algorithms that I am implementing it turned out to be useful storing ids in order to iterate on objects, while also avoiding having to think about reallocation and invalidation of ...
3
votes
2answers
92 views

A traits class for (compound) pointers - beyond what std::pointer_traits offers

This is a percolation of ideas which originated this SO question: Compound pointer traits class with method generalizing make_shared and make_unique? The ...
4
votes
2answers
133 views

Thread-safe cache using a linked list

Are the final templated functions allocate and deallocate thread safe? The Cache object is a ...
4
votes
1answer
88 views

Simple event dispatcher

Here is my very first event dispatcher. I would like to get both, style and code review, as well as some ideas to improve this implementation (new features etc.) I tried to write code in C++17 style ...
5
votes
1answer
207 views

Generalized Cartesian Product

Much to my chagrin, neither STL nor Boost has a cartesian product. Namely, given as arguments one or more iterables, create an iterator producing std::tuples of ...
10
votes
3answers
120 views

Compute mean and variance, incrementally

I have previously reviewed code that computes standard deviation using the mathematical formula E(x²) - E(x)², and warned against the use of this formula because floating-point precision is severely ...
3
votes
1answer
74 views

Deep-copyable unique_ptr wrapper with std::visit-like feature

I'm writing a simple wrapper for std::unique_ptr, which copies the pointed object when copied. Unlike this wrapper, it properly copies derived classes if ...
3
votes
1answer
65 views

Pre-baked Hash table with a flat memory layout

A few notes: There is currently no non exception-based way of knowing whether a key is present in the table or not. This is intentional for my use case. Unlike the lookup process, the baking process ...
5
votes
2answers
183 views

Better generic binary search tree in C++

Introduction This is a follow-up to my previous question. This code rocks new ground-up implementation of core functionality, which I made from combining @vnp’s and @JDługosz's answers. The core ...
8
votes
1answer
64 views

Implementing and benchmarking Radix Sort on unsigned integers

Introduction I implemented a restricted version of the sorting algorithm, the one that works only with unsigned integers. I wanted to try using ...
10
votes
1answer
145 views

Consuming a picnic lunch

I have a number of related classes (Burger, Pizza, Cupcake) with a common base class ...
4
votes
2answers
239 views

Format log with a small macro logger

The goal of this code is to format any log to STDOUT and STDERR with the file and the line of where the call is made. I took ...
2
votes
2answers
105 views

Wrapper for a raw array so that it can be passed to templates expecting Standard Library containers

I am working with a code base where unfortunately I cannot replace all raw arrays with std::array. The spec provides no guarantee that the memory layout of a ...
1
vote
1answer
79 views

Configuration Manager

The idea here is to implement a configuration system using INI files for a pathfinding library nammed Kraken. This library is in java and I am helping implementing it in C++. The goal is to make it ...
4
votes
2answers
256 views

Object pool for allocating generic objects in aligned memory

I made a single header object pool for use in personal projects. It's supposed to be easy to use, cross-platform and thread safe. It uses a free list for allocations and a hashmap for dereferencing ...
5
votes
2answers
137 views

Generic in order traversal iterator for binary trees

This actually started off as member type for the binary_search_tree, but after realizing that it doesn't compare to values or use the value objects inside of it, I ...
7
votes
2answers
420 views

Generic binary search tree in C++

Introduction This is yet another data structure I'm going over again for the algorithms course. This time it is binary search tree. Implemented operations: Insert Exists Remove Clear Move ...
7
votes
2answers
56 views

Acts like an iterator, but counts

I’m making a “counting iterator” which emulates a constant container of consecutive values of some integral type. It is mostly boilerplate, going through the list of requirements for different ...
8
votes
1answer
271 views

Bitmask adapter

Today I had some time and tried to improve my own Bitmask adapter class. It's common practice to eliminate sets of boolean variables with something like a flag system. The old fashioned way was to ...
3
votes
1answer
141 views

Variadic strcat for c++17

On some video from CPPcon, some one said that there should be variadic overload for operator+ as it can solve allocation when there are multiple ...
2
votes
1answer
120 views

Simple C++ allocator for POD types

Edit 1 after first review: I changed to use malloc / free since apparently it's also easier to optimize than ...
2
votes
1answer
79 views

Template function for splitting strings in C++

I'd like to write a function to split strings in C++ to check my template learning. I've also read some relavent questions in this site but most of them don't use templates or ...
3
votes
2answers
65 views

Operations on a heap

Introduction I started going through some basic algorithms as I'll have algorithms course next semester. The last time I've written any heap operations is around 5 years ago. This time around it took ...
6
votes
0answers
326 views
+50

Using multiple console windows for output

In my current project I found the need to concurrently track the progress of multiple concurrent components, and having all of them output their (debug) information into a single console window made ...
3
votes
2answers
102 views

Math matrix, mainly for graphics

I wrote a matrix library to replace my old matrix library. I was using my old matrix library to do basic operations for 3D rendering but that library grew old and now I'm seeking to replace it. I'm ...
3
votes
1answer
126 views

2D rendering abstraction

This is a simple 2D rendering abstraction that I've been using for my game. It's basically a vector of quads. It has functions for defining quads (position, rotation, texture coordinates) and a ...
4
votes
1answer
99 views

ASCII to uint16 using fallthrough

Introduction Watching this talk, I thought may be I could apply it on parsing smaller numbers, like std::uint16_t. I augmented it though, by using a fallthrough ...
10
votes
1answer
327 views

C++ Inventory System

I have recently been working a lot on a project for a system that represents an inventory and item usage in a game, with one of the important features is that it should be reusable in multiple ...