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

Questions tagged [c++]

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. This tag should be used for any question which requires knowledge or expertise with the C++ programming language. This is a general tag which is used for any of the C++ language standards (C++98, C++11, C++17, etc.). The question should identify the compiler being used, the operating system, and which of the C++ standards is being targeted.

Filter by
Sorted by
Tagged with
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,018
7 votes
1 answer
172 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
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,018
4 votes
1 answer
71 views

My C++ Implementation of the Observer Pattern

I have written my own basic implementation of the Observer pattern. Please code review it as you feel. This is a one file implementation, and any feedback no matter how small is appreciated. One ...
Archie Payne's user avatar
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,018
3 votes
3 answers
1k views

Rock Paper Scissors Game feedback

I made this Rock Paper Scissors game using C++. This is my first time doing it and it took me around 3 hours. I know that since I am unexperienced, there is probably a much easier and shorter way of ...
Dalha Dalha's user avatar
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
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
4 votes
1 answer
74 views

Terminal based game: Part 3 (Using templated game)

Working from previous posts In this post: Terminal based game: Part 2 I introduced the concept of a Game object. To build a game like Terminal Base Snake you could ...
Martin York's user avatar
  • 95.2k
4 votes
1 answer
72 views

Terminal Base Snake

Based on this Framework Terminal based game: Part 2 A game that uses std::cout to print the board and std::cin to get keyboard ...
Martin York's user avatar
  • 95.2k
4 votes
1 answer
86 views

Terminal based game: Part 2

Follow up to: Terminal based game Finished up the framework. Still sticking with the X-Term based version. As I want a very simple framework to use for teaching (not this part initially). But my next ...
Martin York's user avatar
  • 95.2k
4 votes
2 answers
136 views

Game of life code in C++

Does my code for game of life look good enough? What changes can I make to optimize the code? I am a beginner to java and I've coded the Game of Life! For those not familiar, the game entails creating ...
ap0calypse's user avatar
6 votes
2 answers
2k views

Terminal based game

Looking to build a terminal based game. I am assuming X-Term like terminal. This means: I can use the X-Term control codes to clear and move around the screen. I can use ...
Martin York's user avatar
  • 95.2k
3 votes
1 answer
84 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,018
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
2 votes
2 answers
153 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
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,018
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,018
6 votes
1 answer
492 views

Checking to see if the current time is close to 9PM

I want to check if the current time is "close" to 9pm UTC. I have the following code to a.) get "now" and convert it to UTC time and b.) get 9pm utc time. Based off when I run it, ...
Taylor's user avatar
  • 241
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
5 votes
2 answers
543 views

Function templates for serializing/deserializing POD types

Are the two function templates below well-formed for serializing/deserializing POD types? Will they work for all the different types that satisfy the constraint pod?...
digito_evo's user avatar
3 votes
2 answers
109 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
3 votes
1 answer
126 views

C++ inline minimalist thread pool

This is a "minimal thread pool" I came up with to compare with a colleague's approach using Rust's Rayon's par_bridge() to automatically parallelize ...
Wasfi JAOUAD's user avatar
5 votes
1 answer
136 views

De/Serialize uint32_t from/to ASCII to use it in Arduino code

Despite the intention is to use it in a C++ project I put the c tag also because there is nothing C++-only (except references :)) in the code (I did not compile it ...
LRDPRDX's user avatar
  • 831
3 votes
1 answer
232 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
3 votes
1 answer
108 views

Multithreaded natural language text parser (Rev.3)

This is the third iteration of the Multithreaded natural language text parser code review. Special thanks goes to G. Sliepen who conducted the first two reviews. Before reading this post, please read ...
Damir Tenishev's user avatar
2 votes
1 answer
55 views

recursive_find and recursive_find_if_not Template Functions Implementation in C++

This is a follow-up question for A recursive_find_if Template Function with Unwrap Level Implementation in C++ and recursive_invocable and recursive_project_invocable Concept Implementation in C++. I ...
JimmyHu's user avatar
  • 5,018
2 votes
1 answer
67 views

Multithreaded natural language text parser (Rev.2)

This is the second iteration of the Multithreaded natural language text parser code review. Special thanks goes to G. Sliepen who conducted the first review. Before reading this post, please read the ...
Damir Tenishev's user avatar
4 votes
1 answer
156 views

Trie implementation using std::shared_ptr

I've implemented a basic Trie that is supposed to work only with lowercase English letters. ...
csmathhc's user avatar
  • 153
1 vote
2 answers
82 views

Advent of Code 2023 day 1: Trebuchet (Part 2)

Task: The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits (which ...
Harith's user avatar
  • 6,872
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,018
2 votes
1 answer
105 views

Multithreaded natural language text parser

Could you please conduct code review for the code below and suggest some improvements? Functional specification Implement a multithreading parser based on existing natural language tokenizer. Parser ...
Damir Tenishev's user avatar
4 votes
1 answer
150 views

Natural language text fast tokenizer (Rev.5)

This is the next iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen, Toby Speight and uli who conducted previous reviews and to Matthieu M. and Adrian ...
Damir Tenishev's user avatar
4 votes
3 answers
1k views

Advent of Code 2023 day 1: Trebuchet (Part 1)

Task: The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and ...
Harith's user avatar
  • 6,872
3 votes
1 answer
110 views

Performing tasks on for-loop over thousands of items in Rcpp

I am trying to adapt an R script that I wrote to perform several tasks in a for-loop. The for-loop run over thousands of items, for about 900 times, therefore I would like to optimise my code at the ...
CafféSospeso's user avatar
3 votes
1 answer
70 views

Natural language text fast tokenizer (Rev.4)

This is the forth iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen, Toby Speight and uli who conducted previous reviews and to Matthieu M. and ...
Damir Tenishev's user avatar
5 votes
2 answers
515 views

Natural language text fast tokenizer (Rev.3)

This is the third iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen, Toby Speight and uli who conducted previous reviews and to Matthieu M. and ...
Damir Tenishev's user avatar
6 votes
2 answers
349 views

A simple find function with concepts

I have written the following simple find function template that does a linear search. ...
digito_evo's user avatar
3 votes
3 answers
1k views

First C++ Program: Race Car Driver Points Calculator

Task: Write a program that is given three numbers corresponding to the number of times a race car driver has finished first, second, and third. The program computes and displays how many points that ...
Harith's user avatar
  • 6,872
3 votes
1 answer
103 views

Natural language text fast tokenizer (Rev.2)

This is the second iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen and Toby Speight who conducted the first review. Functional specification ...
Damir Tenishev's user avatar
4 votes
1 answer
163 views

Track and trace allocations

When testing or debugging allocator-aware objects, it can be useful to provide allocators that can provide insight into how they get called. The Tracing_alloc from ...
Toby Speight's user avatar
  • 75.8k
6 votes
2 answers
520 views

Natural language text fast tokenizer

Could you please conduct code review for the code below and suggest some improvements? Functional specification Implement a function for fast tokenization of text in char[] buffer handling some ...
Damir Tenishev's user avatar
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,018
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
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 ...
machine_1's user avatar
  • 581
5 votes
2 answers
414 views

Demonstrate effects of summation order

When we add lots of floating-point values, we can lose precision if we blindly use std::accumulate() or similar, when the running total becomes much larger than the ...
Toby Speight's user avatar
  • 75.8k
4 votes
2 answers
361 views

Count the frequencies of each word in a file

I have tried to implement a code that does the following: store words in an array (unordered) use function order_array() to place repetitions for the same word ...
Arsenio's user avatar
  • 43
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 ...
Joel's user avatar
  • 133
5 votes
3 answers
1k views

A Dynamic Bitset that I wrote and will use in my compression algortithm. This will be used to store the chars as bits from fstream

I have currently implemented an increment method. A method to add bytes. And a method to print out the bitset.   Main.cpp ...
Christian Phillips's user avatar