Skip to main content

Questions tagged [c++20]

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

9votes
2answers
332views

Simple LRU cache implementations in C++20

LRU cache is a classical design pattern frequently questioned in programming technical interviews. It is best illustrated with pictures. Here are two examples. The following are two alternative ...
bobeff's user avatar
10votes
3answers
2kviews

C++ std::optional implementation for tech interview

I'm preparing for entry-level C++ developer interview and decided to implement some of std:: members. Here's my implementation of std::optional. I would be grateful ...
BreamLashed's user avatar
9votes
4answers
1kviews

C++20 Singly Linked List with Iterator

Below is the code I wrote to implement a singly linked list. To keep things simple, I omitted things like copy constructor. Aside from general feedback, here are some specifics I would like addressed: ...
user1446642's user avatar
10votes
4answers
1kviews

Linear version of std::bit_ceil that computes the smallest power of 2 that is no smaller than the input integer

I am not looking for feedback on the algorithm itself, but rather on the implementation; things like modern C++20 writing, style, proper ways to test and handle the validity of input (should I be ...
user1446642's user avatar
4votes
2answers
389views

Arena/Region Allocator in C++ (rev 2)

2nd revision of original post: Arena/Region Allocator in C++ Context, changes Trying to get a better grasp on low-level memory management, I implemented an arena allocator in C++. It's a rough ...
HernanATN's user avatar
5votes
1answer
73views

Implementation of semantically safe interface for `std::future::then`

Disclaimer: I am not a fan of the then concept, specifically as a mutating non-static member function. As of now, it has only been introduced as part of the ...
Sergey Kolesnik's user avatar
9votes
1answer
371views

SIMD Softmax implementation

I am learning SIMD and looking for feedback. This is column-wise Softmax for matrices stored in row-major format. Note that matrices come from outside so padding or dimensions being power of 2 can't ...
Eugene's user avatar
7votes
1answer
774views

C++20 Robust File Interface

I'm working on a homebrew game engine in C++20. I needed a robust, minimal-overhead, and easy way to load files into memory. I ended up with this: a simple, easy file loader. It doesn't have many ...
Israfil Argos's user avatar
15votes
2answers
521views

Custom implementation of `std::unique_ptr<T>`

I skimmed through the documentation on cppreference.com and put down the basic functionalities expected out of a unique_ptr<T> implementation. I coded up a ...
Quasar's user avatar
4votes
2answers
424views

Get histogram of bytes in any set of files in C++20

Intro This post is the continuation of Get histogram of bytes in any set of files in C++14 - take II. This time, I have incorporated almost all suggestions in the answers. Code My newest trial looks ...
coderodde's user avatar
4votes
3answers
371views

PIMPL based logging interface to print multiple parameters at once

I have implemented my own logger based pimpl idiom. As a third party lib, I used spd log. My focus is to provide an interface to the end user who wants to print multiple parameters at once. I also ...
Cabbas's user avatar
2votes
1answer
105views

Framework for object creation and method invocation using strings (for use with scripting)

My team is working on replacing our in-house scripting solution which will allow users to control the software and access data using their own external scripts. The plan is to use a class hierarchy ...
Swepps's user avatar
4votes
2answers
459views

Second Try at C++ 20 Generic Dictionary for enums and Strings

This is a follow up question to Abstract Generic Dictionary. Some of the code reviewed in this question was also reviewed in C++20 Performance Test Code Generator. The new template class attempts to ...
pacmaninbw's user avatar
  • 25.7k
3votes
1answer
71views

Simple Web Server

Getting close to the library I want. Here is me using the library I have been posting in chunks to build a functional Web Server. Any suggestions on code or interface changes. I want the code to look ...
Loki Astari's user avatar
5votes
1answer
288views

Converting a char string to wchar_t string based on a given toWideStr() starting point

I'm working on a legacy code base and I came across a method in which I wanted to remove the chance of swallowing an exception. In the following I want to walk you through the refacoring process, ...
Thomas Weller's user avatar

153050per page
close