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

Questions tagged [c++20]

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

Filter by
Sorted by
Tagged with
8 votes
3 answers
2k views

fmap for containers in c++

I implemented a simple fmap for containers. However containers don't have a unified function to add elements. So I wrote different concepts for different containers. Is there a better way to implement ...
3 votes
1 answer
147 views

Advanced String Calculator in C++

This is a follow-up question for String Calculator in C++. Considering the suggestions mentioned in MrBean Bremen's answer and Martin York's answer. I am trying to modify the code and trying to ...
4 votes
2 answers
129 views

String Calculator in C++

As a coding exercise, I am trying to implement a calculator which takes string as input, with addition (+), subtraction (-), multiplication (*), division (/) and power (^) functions. For example, ...
4 votes
2 answers
606 views

is_number Function Implementation in C++

I am trying to implement a function which can determine a string is a number or not. Both positive and negative integers / floating numbers are considered. The experimental implementation ...
4 votes
0 answers
73 views

Image Rotation with Shear Transformation in C++

This is a follow-up question for Image Rotation and Transpose Functions Implementation in C++ and An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying ...
2 votes
1 answer
54 views

Looking for feedback on a flavour of Radix tree I wrote. This is version 2 of the class original posted on this forum

My project explores some ideas i've had regarding alternate data structures to the unorderd_map and map, and aiming the exploration to key sets with a non uniform distribution and key sets with common ...
1 vote
0 answers
87 views

An Updated recursive_transform Template Function Implementation in C++

This is a follow-up question for A recursive_transform_view Template Function Implementation and A recursive_transform_view Template Function which returns a view in C++. In those implementations ...
1 vote
0 answers
36 views

recursive_remove_copy_if and recursive_remove_copy Template Functions Implementation with Execution Policy in C++

This is a follow-up question for recursive_remove and recursive_remove_if Template Function with Unwrap Level Implementation in C++. I am trying to implement ...
1 vote
1 answer
33 views

recursive_remove and recursive_remove_if Template Function with Unwrap Level Implementation in C++

This is a follow-up question for recursive_find and recursive_find_if_not Template Functions Implementation in C++ and A recursive_copy_if Template Function Implementation with Unwrap Level ...
4 votes
1 answer
97 views

A recursive_copy_if Template Function Implementation with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_copy_if Template Function Implementation in C++ and recursive_invocable and recursive_project_invocable Concept Implementation in C++. I am trying to ...
8 votes
2 answers
439 views

Image Rotation and Transpose Functions Implementation in C++

This is a follow-up question for Gaussian Fisheye Image Generator Implementation in C++ and An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying to ...
5 votes
2 answers
604 views

Generic multithreading solution for improving the performance of slow tasks

I'm currently in the process of replacing an archaic multithreading solution using some of the newer C++ standard library features now that our software has been updated to use C++20. Previously, most ...
3 votes
1 answer
85 views

Gaussian Fisheye Image Generator Implementation in C++

This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++ and Three dimensional gaussian image generator in C++. I am trying to make a ...
4 votes
1 answer
186 views

Looking for feedback on a flavour of Radix tree I wrote. The idea is speed on find() time if keys share common prefixes and are known ahead of time

My project explores some ideas i've had regarding alternate data structures to the unorderd_map and map, and aiming the exploration to key sets with a non uniform distribution and key sets with common ...
1 vote
0 answers
45 views

An Updated recursive_transform_reduce Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_transform_reduce Template Function with Unwrap Level Implementation in C++. To fix the issue mentioned in G. Sliepen's answer, I updated the test cases and ...
2 votes
1 answer
44 views

A recursive_transform_reduce Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_transform_reduce Function for Various Type Arbitrary Nested Iterable Implementation in C++ and recursive_invocable and recursive_project_invocable Concept ...
4 votes
1 answer
180 views

Order guaranteed recursive_transform template function implementation with execution policy in C++

This is a follow-up question for A recursive_transform Template Function with Execution Policy, A recursive_transform Template Function Implementation with std::invocable Concept and Execution Policy ...
3 votes
1 answer
233 views

Logging in a different thread using circular buffer C++

What it does The code creates a logger class which instantiates a circular buffer at construction and uses producer-consumer style approach using condition_variable to log and print the messages to ...
3 votes
1 answer
193 views

Generic feedback on a replacement of `<cctype>`

I use a lot <cctype> functions, but they're not very type safe and and calling them with a negative char is (theoretically) undefined behavior, so my code is ...
2 votes
1 answer
51 views

recursive_invocable and recursive_project_invocable Concept Implementation in C++

This is a follow-up question for A recursive_find_if Template Function with Unwrap Level Implementation in C++. I am trying to make some constrains on Proj and <...
1 vote
2 answers
65 views

A recursive_find_if Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_find_if_all Template Function Implementation in C++, A recursive_all_of Template Function Implementation in C++ and A recursive_all_of Template Function ...
2 votes
1 answer
46 views

A collection based on a bitset to store a set of unique integers from a given range (rev. 3)

All right, let's do this one last time. This is continuation of this review. I applied most of the proposed changes, making interface of my container very close to that of ...
6 votes
1 answer
942 views

Split command in C++20

The Windows OS doesn't feature a Split command and although I do have a Linux partition, I mainly use Windows 11. As such, I implemented the ...
3 votes
1 answer
109 views

Writing a multidimensional array view for contiguous arrays in C++20

When creating little games or other programs I often need multidimensional arrays. Usually I just do the simple std::vector<std::vector<T>> thing for ...
4 votes
1 answer
75 views

A collection based on a bitset to store a set of unique integers from a given range (rev. 2)

This is a continuation of this review. I applied most of the proposed changes. These changes were focused mostly on decoupling the class from the rest of the program and making its interface more like ...
1 vote
1 answer
79 views

Collection that uses a bitset to store a huge set of unique integers from a given range (rev. 1)

Some (skippable) context: I'm writing program that minimizes an arbitrary logical function. Such function takes an unsigned integer as an argument and returns either ...
3 votes
1 answer
40 views

A recursive_all_of Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_find_if_all Template Function Implementation in C++ and A recursive_all_of Template Function Implementation in C++. To support ...
2 votes
2 answers
82 views

A recursive_all_of Template Function Implementation in C++

This is a follow-up question for A recursive_foreach_all Template Function Implementation in C++. I am trying to implement recursive_all_of template function in ...
1 vote
0 answers
58 views

Stand/Bench for testing emergency situations for 2p2 networks in games

In fact, this is a throttling proxy. It can work in two modes: "paired" and "multi-Client". In "pair" mode, two clients connect to each other through a proxy, very ...
1 vote
1 answer
58 views

A recursive_find_if_all Template Function Implementation in C++

This is a follow-up question for recursive_any_of and recursive_none_of Template Functions Implementation in C++. I am trying to follow the suggestion of G. Sliepen's answer to implement ...
1 vote
1 answer
45 views

recursive_any_of and recursive_none_of Template Functions Implementation in C++

This is a follow-up question for A recursive_all_of Template Function Implementation in C++ and A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides <...
4 votes
2 answers
315 views

C++ Deque Implementation

Took a shot at implementing std::deque in C++. I aimed for amortized O(1) push_front and <...
2 votes
3 answers
170 views

Wrap a noexcept C++ library method with a method throwing exceptions with usable explanatory strings to stay DRY

In our apps we're using a shared inhouse library which provides filesystem functions. All the functions are noexcept. In several apps i found that similar or identical error return translations are ...
3 votes
1 answer
97 views

Is it valid to pass struct through std::fold_left to persist state?

I am exploring functional programming design with C++. The code below uses a struct passed to ranges::fold_left for processing. The final result is returned in the ...
5 votes
2 answers
826 views

Three dimensional data structure in C++

This is a follow-up question for Three dimensional gaussian image generator in C++. Considering the suggestion from G. Sliepen: Structure of a 3D image Your 2D ...
5 votes
2 answers
525 views

Three dimensional gaussian image generator in C++

This is a follow-up question for Two dimensional gaussian image generator in C++. Besides the two dimensional case, I am trying to implement three dimensional gaussian image generator which with ...
18 votes
3 answers
3k views

trimming a string using C++20 ranges

I have a function which is supposed to trim a string by removing trailing whitespace, then exactly one instance of a fixed string, if it exists, and then any remaining trailing whitespace. It works ...
7 votes
3 answers
778 views

Optimizing Vector 2D Length Comparisons in C++

I've encountered a readability issue in C++ when comparing the length of a vector to a scalar. Commonly, I see solutions like this: ...
5 votes
2 answers
317 views

An is_integer Template Function Implementation in C++

I am trying to make an is_integer template function to determine a number is an integer or not. The experimental implementation ...
2 votes
1 answer
109 views

Basic foundation for a physics engine using SFML and Dear ImGui

I want to create a very basic physics engine in SFML. I also want to be able to control objects using Dear ImGui. So I created this basic foundation. My main problem with it is how I handle rendering ...
2 votes
2 answers
82 views

A recursive_minmax Template Function Implementation in C++

This is a follow-up question for A Maximum Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides the function for finding maximum, I am trying to implement ...
4 votes
1 answer
148 views

A Maximum Function For Various Type Arbitrary Nested Iterable Implementation in C++

This is the follow-up question for A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides the summation case, I am trying to implement a ...
3 votes
1 answer
421 views

C++ implementation of a concurrent queue and of a thread pool

I am working on an implementation of a concurrent_queue<T> and pf a ThreadPool, see beneath. The objectives are CPU ...
4 votes
2 answers
252 views

C++ heap allocator using an explicit free list

Description I've written a heap allocator in C++ using an explicit free list for organization. I've also written a series of unit tests and a microbenchmark using Catch2. At time of writing I've ...
5 votes
1 answer
372 views

C++20 Coroutine Task

This project is the natural extension to my attempt to make a templatedgenerator coroutine. This time, I tried what I called a "...
2 votes
1 answer
198 views

Alarm - Timer - Stopwatch with <chrono>

Alarm, timer and stopwatch in the style of the standard library. Important design notes: The accessors do not update internal state, the user is responsible to call ...
1 vote
1 answer
98 views

An Updated recursive_reduce_string Template Function Implementation in C++

This is a follow-up question for A recursive_reduce Template Function with Unwrap Level Implementation in C++ and A recursive_reduce_string Template Function Implementation in C++. Considering the ...
4 votes
1 answer
406 views

Single threaded epoll based coroutine library for C++, Linux

I've implemented a small single-header library over the C++20 coroutines. This library only works on a single thread and it is limited to Linux because it is also based on epoll. The library does not ...
1 vote
1 answer
108 views

A recursive_reduce_string Template Function Implementation in C++

This is a follow-up question for A recursive_sum Template Function Implementation with Unwrap Level in C++, A recursive_reduce_all Template Function Implementation ...
0 votes
1 answer
80 views

wtpdmt - Windows thread preemption duration measurement tool (C++)

I have this repository. The idea is that the user may measure for how long the thread is preempted with given priority class/thread priority. CommandLineParser.h: <...

1
2 3 4 5
7