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
4 votes
1 answer
30 views

C++ program to format byte sequences into Python like string representations

This is a C++ program I wrote, that includes functions to convert integers to byte sequences in little endian or big endian order, and functions to convert a byte sequence to a string representation. ...
Ξένη Γήινος's user avatar
4 votes
2 answers
56 views

locale-aware trim functions for std::string

I have written the below two trim functions for std::string and std::basic_string that are locale-aware. Both trim all white ...
digito_evo's user avatar
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 ...
Yu Cong's user avatar
  • 83
3 votes
1 answer
148 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 ...
JimmyHu's user avatar
  • 5,020
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, ...
JimmyHu's user avatar
  • 5,020
4 votes
2 answers
607 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 ...
JimmyHu's user avatar
  • 5,020
4 votes
0 answers
74 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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
ver2's user avatar
  • 61
3 votes
1 answer
86 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 ...
JimmyHu's user avatar
  • 5,020
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 ...
Swepps's user avatar
  • 53
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 ...
ver2's user avatar
  • 61
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
3 votes
1 answer
234 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 ...
wwite's user avatar
  • 33
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 <...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
Piotr Siupa's user avatar
6 votes
1 answer
943 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 ...
machine_1's user avatar
  • 581
3 votes
1 answer
110 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 ...
Joel's user avatar
  • 133
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 ...
Piotr Siupa's user avatar
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 ...
MatG's user avatar
  • 149
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
Alexovsky's user avatar
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 ...
Piotr Siupa's user avatar
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 ...
JimmyHu's user avatar
  • 5,020
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 <...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
4 votes
2 answers
317 views

C++ Deque Implementation

Took a shot at implementing std::deque in C++. I aimed for amortized O(1) push_front and <...
jdav22's user avatar
  • 361
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 ...
ridilculous's user avatar
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 ...
rm1948's user avatar
  • 185
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
Edward's user avatar
  • 66.4k
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: ...
nowox's user avatar
  • 1,099
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
3 votes
1 answer
422 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 ...
EricFlorentNoube's user avatar
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 ...
pdm's user avatar
  • 307
2 votes
1 answer
110 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 ...
passsterf's user avatar
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
JimmyHu's user avatar
  • 5,020
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 ...
demiralp's user avatar
  • 133
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: <...
coderodde's user avatar
  • 28.4k
4 votes
1 answer
408 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 ...
Pangi's user avatar
  • 155
4 votes
4 answers
2k views

Yet another shared_ptr implementation for learning purposes

C++ shared_ptr implemented as a coding practice and learning purposes. It uses std::shared_ptr interface. Basic tests are included (using single header Catch 2) Some methods are omitted to keep the ...
Tomas Tintera's user avatar
8 votes
3 answers
3k views

C++ std::optional implementation

Took a shot at implementing a subset of std::optional functionality. A lot of core features are there but some things like converting constructors, etc are missing ...
jdav22's user avatar
  • 361

1
2 3 4 5
7