Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [c++17]

Code that is written to the 2017 version of the C++ standard. Use in conjunction with the 'c++' tag.

Filter by
Sorted by
Tagged with
4 votes
2 answers
362 views

Compile time string manipulation in C++

I recently had to work on some conversion of literal strings and wondered if that could be done at compile time using template meta programming. I couldn't find many examples online, so I started ...
adepierre's user avatar
  • 115
4 votes
1 answer
339 views

Is this a sane (as in lacking UB) implementation of a ref-counted subscription cleanup?

AutoCancel is a class which wraps a Cancel (aka void()) function. The purpose of wrapping ...
smac89's user avatar
  • 1,509
7 votes
2 answers
187 views

Function composition in the context of data processing pipelines

Prior Notification This follows a previous review of mine that addressed the core helper function named make_skippable. The composition implementation presented ...
mahush's user avatar
  • 115
2 votes
1 answer
77 views

Scene Hierarchy with Translation, Rotation and Scale

This code represents an Entity Component that holds and manipulates an entity's local and world transforms, dealing with hierarchy and translation/rotation/scale transformations. The code is written ...
Daniel Marques's user avatar
2 votes
2 answers
154 views

Is this a good pattern for handling late-initialized of class type?

Are there any issues with this class template? It is supposed to provide an easy-to-use object solution to initialize an object of class type after the declaration of the variable. One nuisance is the ...
Bolpat's user avatar
  • 233
4 votes
2 answers
102 views

TCP socket base class and Winsock implementation

I'm coding a chat application from scratch in modern C++. I'm currently building an interface for interacting with sockets. I want it to be cross platform. Am I approaching platform independence ...
Cherestes Radu's user avatar
3 votes
2 answers
112 views

Extending callable signature with std::optional in context of function composition (make_skippable)

(Please note: the post about the compose implementation announced below is now available.) This is about decorating callables by making their argument and return value to be a ...
mahush's user avatar
  • 115
4 votes
1 answer
308 views

c++ quicksort pivots

Is this code for quicksort using the first index as a pivot correct? Also if I want to use the last or middle index as a pivot how would the whole code change? ...
Kqehzo's user avatar
  • 41
3 votes
1 answer
124 views

Dynamic code syntax error reporting

Full code is below. Any feedback is welcomed. I am trying to implement syntax error reporting like GCC and other ...
Alix Blaine's user avatar
2 votes
3 answers
140 views

Othello (Reversi) in C++17 and CMake

Othello is a two-player strategy game typically played over the board. I implemented Othello in C++17 with CMake as the build system. I'm looking for feedback on cleanness, readability, and ...
aadithyaa's user avatar
4 votes
1 answer
90 views

Member (virtual or not) function to C callback by generating static version at compile time

I've started to write a header-only implementation of callback for member functions : ...
hl037_'s user avatar
  • 141
3 votes
1 answer
48 views

Logger with a Core and Client side

This logger is for a game engine I'm writing it has a core side which is the game itself and a client side which is the engine. The architecture of the code I feel like is messy it has the main log ...
rrandel's user avatar
  • 55
5 votes
2 answers
894 views

Given a type, search for an item of that type in a std::tuple

In my project, I want to search for an item of a given type in a std::tuple at compile time. The given type might not be present in the tuple at all, in which case ...
dw218192's user avatar
  • 153
2 votes
1 answer
135 views

A simple threadpool in C++17

Implemented a simple thread pool that executes task asyncly, and returns a simple future you can wait on. Can you please suggest improvements? ...
HeavyIsSpy's user avatar
1 vote
1 answer
71 views

Asynchronous OOP-based networking using the Epic EOS SDK

There is also a limitation from the Epic EOS SDK in the absence of thread safety, all "C" calls can only be made from one thread. And from the thread where the SDK was initialized. Based on ...
Alexovsky's user avatar
2 votes
1 answer
111 views

ReadDirectoryChangesW Improvements

I'm currently using the ReadDirectoryChangesW Function from the Windows API to build a Directory Watcher. The Watcher should monitor a folder for newly added files. ...
Kevin's user avatar
  • 147
2 votes
1 answer
192 views

OrderBook Implementation - Follow up

This is a follow up to my previous implementation: The input is of the format ...
Avengerx9's user avatar
2 votes
2 answers
285 views

Design decisions for an efficient OrderBook

I am designing code for OrderBook based in C++, based on STL library. Note that there is a related question here, however it is more simple - it does not support deletion of orders, and I intend to ...
Avengerx9's user avatar
6 votes
4 answers
639 views

C++ custom string class implementation

I recently had an interview where I was tasked with implementing a custom C++ string class without using the STL. The interviewer provided the function signatures and variable declarations, specifying ...
Jacob's user avatar
  • 131
-2 votes
1 answer
261 views

Design a set to classes to report battery/power status of different Alexa devices

I was asked below quesion in Amazon sde2 low level design interview recently and I have shown below my solution during the interview. I was rejected in this round. ...
sachin's user avatar
  • 55
6 votes
2 answers
978 views

std::chrono compatible clock using CLOCK_MONOTONIC_RAW

We're using std::chrono::steady_clock for most of our internal queues and relative timings. However, we're on a POSIX platform and ...
Ted Lyngmo's user avatar
5 votes
2 answers
203 views

C++ UniquePtr Implementation

Took a shot at implementing std::unique_ptr. Code: ...
jdav22's user avatar
  • 361
1 vote
1 answer
203 views

HTTP routing with Mongoose

I'm trying to extend the Mongoose RESTful server example with URL routing. This code relies on the Mongoose library available here. This is heavily inspired by the routes class from this question but ...
S Meredith's user avatar
2 votes
1 answer
90 views

Better JVM Bytecode Struct with Serialiser & Parser Without #MACROS

Preamble I was inspired by this review request to create my own quasi JVM Byte Code Struct, Parser and to top it a bit I also wrote two a quasi executors. Currently, they just print the instructions ...
Ajinkya Kamat's user avatar
8 votes
2 answers
977 views

JVM bytecode instruction struct with serializer & parser

I am writing a java class file parsing & serialization library. As part of that i needed to implement a structure for the JVM bytecode instructions as well as come up with a way to parse & ...
p0sa's user avatar
  • 81
4 votes
2 answers
2k views

Fast OrderBook Implementation

I'm creating a simple yet fast OrderBook, that only adds orders and matches them (no cancelling or modifications, etc.). I'm using partial template specialization to reduce branching in the hotpath, ...
jpf's user avatar
  • 63
4 votes
2 answers
207 views

Create classes for matrices, including inheritance

I've been learning C++ on and off, and recently learnt about overloading and templates. I wanted to used these concepts to create classes about matrices using ...
eccentricOrange's user avatar
5 votes
1 answer
99 views

leetcode 530. In-order traversal of a binary search tree (C++17)

Given a binary search tree, the problem requires calculating the minimum absolute difference between any two keys in the tree. Given the binary search property, the minimum difference must be between ...
loonatick's user avatar
  • 153
2 votes
1 answer
128 views

QuadTree implementation in c++

I'm new on C++ and OOP. I wrote the following QuadTree implementation (I didn't wrote the remove object part yet). please take a look on it and provide feedback, mainly about C++ OOP design, ...
Joseph Hod's user avatar
4 votes
0 answers
50 views

Variadic pack class providing operations over types without constructing objects of those types

Sometimes I find I want to call a function passing each of a set of types as a template parameter, but without needing to construct an object of those types. I also may want to do this in multiple ...
John Ilacqua's user avatar
2 votes
1 answer
141 views

Class for packing two 4 bit unsigned integer in uint8_t

The purpose for this class is to pack two 4 bit unsigned integer into 8 bit unsigned integer, e.g. uint8_t. It is made in a way, so the class to resemble array of ...
Nick's user avatar
  • 1,582
6 votes
2 answers
610 views

C++ Minimal CSV parser cut2

Looking at this questoin, I was inspired by the idea and the approach, so I tried to write a second version of the code, taking most of the comments into considerations. Please note that I am still ...
Libra's user avatar
  • 71
2 votes
1 answer
3k views

Assignment function for Intervals container

I found the two related questions but they, however, do not answer my question: interval map implementation Where exactly does my code not adhere to the specification of the key and value type? The ...
asm's user avatar
  • 121
2 votes
3 answers
119 views

Chain of Responsibility Pattern using std::any

The following code has a Handler class that follows the classic Chain of Responsibility pattern. But we don't want to write a new handler class for every new type ...
prestokeys's user avatar
  • 1,371
3 votes
1 answer
97 views

Wildcard Matching: LeetCode 44 Attempt 2

Original post: Based on feedback from J-H in his answer I have done another attempt. Link to question: Given an input string (s) and a pattern (p), implement wildcard pattern matching with support ...
Martin York's user avatar
  • 95.2k
6 votes
1 answer
380 views

Program that inputs the number of days in January, (C++ beginner) (from 1 to 31) (separ. at tens), and outputs #'s written out

...
TjGoSwiddly's user avatar
6 votes
1 answer
2k views

String literals concatenation with support for dynamic strings

I have implemented a function to concatenate string literals at compile time. Basic requirements: Very simple API. Can be used as a one-liner. Must accept variadic string literals. Highly optimized ...
Sergey Kolesnik's user avatar
4 votes
1 answer
1k views

JSON value with std::variant

For learning purposes, I wanted to implement a class that could hold JSON data with std::variant. Most of the implementations I found online were using incomplete types as template arguments for map, ...
adepierre's user avatar
  • 115
2 votes
1 answer
141 views

Comparator aware `flat_set` implementation

I am currently implementing a flat_map like container in C++, and had problems with the comparator used. Thus, I reduced it to the bare minimum which I will present here. (In particular, my code here ...
tommsch's user avatar
  • 243
0 votes
1 answer
154 views

Multiple containers share a single memory resource

In my project, I'm trying to use the std::pmr allocator and monotonic_buffer_resource. I'm using vector in various classes, and ...
goodman's user avatar
  • 103
5 votes
2 answers
347 views

Tiny Network Web Framework / Library in C++

I recently wrote a tiny network library in C++17 called Turtle on Linux and wish to seek some improvement advice on how to further develop it. Any insights would be appreciated. Origin: As a student, ...
I Love Turtle's user avatar
3 votes
1 answer
351 views

High performance 3 Way Quick Sort Implementation

My implementation of 3 way quick sort for strings. It supposed to sort very large set of 800,000,000 objects. This is why I added ...
Nick's user avatar
  • 1,582
3 votes
1 answer
441 views

Yet another sparse set implementation

I got inspired by this blog post and implemented a fixed-size sparse set, removing the need for vectors, because the sparse set's size equals at least ...
Tab's user avatar
  • 33
2 votes
2 answers
122 views

Cache for mesh objects

I'm creating a cache system for an object (Mesh) that is expensive to create. A Mesh can be created using a small amount of ...
Joshua Hyatt's user avatar
4 votes
1 answer
2k views

Template to unpack arguments to a std::function

I am writing some C++ code to interact with an external scripting language. I want to be able to register arbitrary C++ callable code as functions to be called from the script. The scripting library ...
David Woo's user avatar
  • 161
2 votes
1 answer
118 views

Reservoir sampling Algorithm A-ExpJ for C++17

Implementation of the Reservoir sampling algorithm A-ExpJ that allows sampling K random elements from a stream of elements according to their weights when we don't know the size of the stream in ...
GameRaccoon's user avatar
2 votes
1 answer
241 views

Reimplementing Alias method in C++

In the following I reimplement the Walker-Vose Alias method for sampling from nonuniform, discrete probability distributions. I am well aware that there is https://en.cppreference.com/w/cpp/numeric/...
mcocdawc's user avatar
  • 944
0 votes
1 answer
62 views

Using of fold expression to read csv file

I've written a code reading csv file using fold expressions. The only thing that should be defined is columns types and file name: ...
amplifier's user avatar
  • 113
-2 votes
1 answer
522 views

How can I optimize C++ serialization? [closed]

I want to serialize a C++ class Ramdomclass . Below is the serialization function. ...
Sebastian Orteho's user avatar
5 votes
1 answer
220 views

Traverse/transform (xml) tree

I am trying to write a utility for transforming xml trees using single pass and specifying node handlers. I used pugixml prior to this, and the library provides a ...
Sergey Kolesnik's user avatar

1
2 3 4 5
12