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
1 vote
0 answers
30 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
2 votes
1 answer
29 views

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

This is about decorating callables by making their argument and return value to be a std::optional. Therefore I created the template function ...
mahush's user avatar
  • 21
4 votes
1 answer
300 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
123 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
125 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
83 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
44 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 ...
Xuul's user avatar
  • 55
5 votes
2 answers
741 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
76 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
67 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
64 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
155 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
230 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
475 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
242 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
5 votes
2 answers
721 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
193 views

C++ UniquePtr Implementation

Took a shot at implementing std::unique_ptr. Code: ...
jdav22's user avatar
  • 361
1 vote
1 answer
159 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
88 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
968 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
1k 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
167 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
88 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
112 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
49 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
109 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,572
6 votes
2 answers
571 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
2k 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
109 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
87 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
  • 94.6k
6 votes
1 answer
378 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
1k 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
909 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
2 votes
1 answer
125 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
142 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
338 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
322 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,572
3 votes
1 answer
387 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
103 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
1k 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
112 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
220 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
59 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
452 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
196 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
4 votes
1 answer
228 views

Multithreaded MVC game engine

This is an attempt at a multithreaded model-view-controller based engine for 2d console games (board games, roguelikes that sort of thing.) The code below will provide a fully working example but is ...
Jaldhar's user avatar
  • 409
0 votes
1 answer
269 views

Flippable atomic boolean

I was trying to implement a boolean that can be atomically flipped. The suggestion on Stack Overflow is to use an integer. This would be my implementation. ...
Antonio's user avatar
  • 133
5 votes
5 answers
951 views

Palindrome Permutation string

I’m starting to learn C++ by doing a lot of exercises, and I need your help so I can improve, Here is how it goes, I will try to solve an exercise and post both the ...
April Morrison's user avatar
4 votes
1 answer
311 views

Bin-packing C++ solution using multi-map

The need (context). Several times a day, we need to migrate a set of digital assets from one system to another. The process uses memory (the assets are held in memory for a short time) and we need to ...
Konchog's user avatar
  • 187
4 votes
1 answer
1k views

A toy application of pub/sub using C++ for self-learning

Firstly, I apologize for the lengthy post. I was not sure which code I should include. In practice of c++, I am writing a toy application for pub/sub using c++17. ...
Sam Hammamy's user avatar

1
2 3 4 5
12