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.

551 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
17 votes
0 answers
1k views

Autotools detect C++ language standard support

I have been updating my build tools to optionally use autotools (autoconfig/automake/libtool etc.). As part of this change I have written a couple of M4 macros. This not being something I have done ...
Martin York's user avatar
  • 95.1k
9 votes
0 answers
553 views

Hunt the Wumpus GUI (FLTK)

I used the code from the text based hunt the wumpus game discussed here: Text based game “Hunt the Wumpus” Version 3 to create a gui Version based on excercises from PPP by Stroustrup. For the GUI i ...
Sandro4912's user avatar
  • 3,066
8 votes
0 answers
989 views

A simple Qt + MQTT doorbell application

So I built a house recently and didn't want to rely on "privacy-questionnable" systems like Google Home or Amazon whatever so I decided to build a doorbell system myself. Hardware I use a ...
tai's user avatar
  • 181
8 votes
0 answers
364 views

Implementing GSL synchronized_value

Core Guidelines mention a type synchronized_value<T>, which supposedly pairs std::mutex with the internal value. I couldn'...
Sergey Kolesnik's user avatar
8 votes
0 answers
2k views

Small Virtual Machine executing its own byte-code

I want present to you my little Virtual Machine. It nothing really sophisticated. It is an stack only virtual machine with the exception for some 'global' variables which i would count as registers ...
ExOfDe's user avatar
  • 553
8 votes
0 answers
564 views

Simple, intuitive and (hopefully) safe EventDispatcher

For my own game engine I need an event system. I tried to avoid the single-huge-enum-approach for minimizing compile times. The BasicEventListener is the (...
Tim Diekmann's user avatar
8 votes
0 answers
376 views

C++ constexpr trampoline

For fun, I implemented a trampoline function for C++ constexpr functions, since the recursion limit for constexpr functions is ...
Justin's user avatar
  • 3,295
8 votes
0 answers
352 views

STTCL FSM framework based on the GoF State Pattern, Part I: The basic interfaces

Preface I have decided to let my pet project created some years ago to undergo a code review here. The review will be broken into parts according to meta question Multiple reviews or one big review?...
πάντα ῥεῖ's user avatar
8 votes
0 answers
350 views

.NET DLL Injector in C++

I built a DLL Injector with User-Interface. The program lists all processes, the user chooses one of them and a DLL, and inject it. It's my first project in C++, and I know it's not exactly C++ ...
Gil Mans's user avatar
8 votes
0 answers
7k views

I am using boost::process to call an external process, and using stdout, stderr, and stdin to supply/retrieve data

I have some program which takes input via stdin, writes output to stdout, and errors to stderr. I would like to call that program from another program, supplying data via stdin, and capturing output/...
DaveM's user avatar
  • 81
7 votes
0 answers
432 views

c++ std::function implementation

When I first tried to implement std::function I thought it would as easy as creating a class that holds a function pointer. Consequently, I quickly figured out that ...
nullptr's user avatar
  • 669
7 votes
0 answers
224 views

Find an arithmetic expression near to target value

I wrote this program as an answer to Express a Number challenge on the Programming Puzzles & Code Golf site; it may be worth looking there for the context. The concept is simple (and familiar to ...
Toby Speight's user avatar
6 votes
0 answers
291 views

Create 'classical' visitor from lambdas

I've watched a talk by Fedor Pikus on design patterns held at CppCon 2019. Motivated by this, I wrote my own visitor implementation and some helpers which allow me to create a visitor from a couple of ...
StefanKssmr's user avatar
6 votes
0 answers
1k views

Make Flutter app on Windows a drop target to accept files

My aim was to provide functionality for a Flutter app on Windows to accept drag-and-dropped files. Flutter apps are written in Dart and compiled to native code, but since this is a cross-platform ...
technolion's user avatar
6 votes
0 answers
545 views

C++17 ECS Implementation

I am (relatively) new to game programming and have been exploring creating an entity component system for my simple 2D game engine. Here is what I have so far: Entity.h ...
user8780062's user avatar
6 votes
0 answers
243 views

Buddhabrot made in CUDA

In the past I have made programs that have generate a buddhabrot with mostly success however all of them were on the CPU and single threaded. As a result they were all slow so I wanted to remake the ...
nullptr's user avatar
  • 669
6 votes
0 answers
165 views

Game event loop for multi-threaded application

My take on this problem for a hobby project. I have an event loop that advances game state and processes user input. Rendering is no concern of this event loop, and is intended to run on a separate ...
Emerald Weapon's user avatar
6 votes
0 answers
490 views

C++17 implementation of std::invoke

C++17 introduces std::invoke which calls the exposition-only INVOKE. Here is an implementation. This isn't a large amount of ...
L. F.'s user avatar
  • 9,550
6 votes
0 answers
213 views

Resource cache based on Stroustrup 22.2.4

I recently read "The C++ programming language" chapter 22 and I thought the example given in chapter 22.2.4 was quite interesting. I thought it should be possible to make this system caching, so it ...
Theo's user avatar
  • 61
6 votes
0 answers
188 views

C++ string Formatter Again Part-4

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
Martin York's user avatar
  • 95.1k
6 votes
0 answers
116 views

Read stock files, gets the candles sequence and makes a report - follow-up

My first question: Read, calculate, write The only thing I kept is the function try-block. This is still a work in progress, that's what I have done so far. Source: ...
DiDi's user avatar
  • 307
6 votes
0 answers
223 views

Value semantic type eraser

I've been using std::unique_ptr for cases where I want to store a derived-type value with type erasure, and felt that unique_ptr being nullable was an undesirable ...
Brent's user avatar
  • 451
6 votes
0 answers
509 views

Console Command module (in-game console or base for script engine)

I've created a console/terminal command handling module that allows the programmer to bind functions to a command name and later execute them from std::string. What's new is that it handles most stuff ...
RippeR's user avatar
  • 161
6 votes
0 answers
181 views

Easy bitset IO v2

In a previous question I posted a method for easy std::bitset IO on a bit-for-bit basis. This question was later followed up in another solution. Both of these ...
Daniel's user avatar
  • 825
5 votes
0 answers
1k views

Qt - Creating a dark overlay to apply on top of other widgets with animation

I want to be able to create a dark overlay on top of other widgets that can be turned on or off with animation. I managed to get this to work. But I think I'm doing it in a wrong and inefficient way; ...
sanab3343's user avatar
5 votes
0 answers
291 views

Optimizing bit-matching performance using AVX compiler intrinsic

We are working on a complicated math problem, very detailed question with description of the problem is here: C++ multi-threaded determination of curling numbers in vectors. That code is now converted ...
Vlad Feinstein's user avatar
5 votes
0 answers
164 views

Using an extra mock simply to take advantage of the behaviour observation tooling

I'm writing integration for a project, but our framework doesn't provide any ability to inject dependencies, so I've written tests with a unit testing framework (GTest) and used a mock (GMock) in an ...
Matt's user avatar
  • 151
5 votes
0 answers
1k views

Polymorphic deleter for unique_ptr

There is a basic difference in the way C++ manages the deleter for std::unique_ptr and std::shared_ptr, mainly for allowing ...
Amir Kirsh's user avatar
5 votes
0 answers
103 views

4×4 cofactor in SSE

The cofactor of a 4×4 matrix can be used to convert a "regular geometry" matrix into the matrix that transforms the normals. It's an alternative to the common inverse-transpose pattern. In this post I ...
harold's user avatar
  • 9,559
5 votes
0 answers
94 views

Interfaces and OOP Design for Image Editor software

I'm new to C++ programming, and I'm building an Image Editor software like Lightroom/CameraRaw from scratch. Apart from procedural code (actually seems that all the functions works correctly) my goal ...
Alessandro Cerro's user avatar
5 votes
0 answers
45 views

JSON Test Harness: Part 2

Part 1: JSON Test Harness: Part 1 Part 3: JSON Test Harness: Part 3 Part 4: JSON Test Harness: Part 4 Time to review some test harness code I have written. https://github.com/Loki-Astari/...
Martin York's user avatar
  • 95.1k
5 votes
0 answers
73 views

JSON Test Harness: Part 1

Part 2: JSON Test Harness: Part 2 Part 3: JSON Test Harness: Part 3 Part 4: JSON Test Harness: Part 4 Time to review some test harness code I have written. https://github.com/Loki-Astari/...
Martin York's user avatar
  • 95.1k
5 votes
0 answers
2k views

C++ game engine event system implementation

I am currently working on the implementation of Event System on a game engine. I have zero experience in Event System implementation or the patterns that are used. What I have done is what I've seen ...
Kenny Wong KennyDBacon's user avatar
5 votes
0 answers
1k views

Quasi-Random Number Generators

I would like to communicate a piece of code which I hope will soon be broadly useful for everyone who programs in C++: A set of quasi-random number generators proposed for addition to boost.random. To ...
user14717's user avatar
  • 785
5 votes
0 answers
164 views

Delegated condition_variable against spurious wakeup

This is my attempt at dealing with spurious wakeups: A new class which replaced std::condition_variable in my code. Some questions which came to my mind are (and I ...
PhilLab's user avatar
  • 193
5 votes
0 answers
92 views

Iterator structure for block and interlace counting schemes

We have a set of time slices, in the order of 50. Throughout this question I will use 6. We group these slices into blocks, in this example the block size is 2. Then we want to iterate through all ...
Martin Ueding's user avatar
5 votes
0 answers
2k views

3D FPS Camera in OpenGL

So I've got a basic FPS camera working which can move around the 3D space. Having trouble with physics but thats not why I'm here! So the code below creates a scenegraph which contains torus model ...
rshah's user avatar
  • 151
5 votes
0 answers
162 views

Using SFINAE with wrappers to terminate compilation early

The Goal Provide some wrappers to a C++11 template library's main entry point so that if the initial template parameter is not valid, the user is informed of exactly what is missing. In the real ...
svenevs's user avatar
  • 205
5 votes
0 answers
1k views

Tuple-like container for packed data

I'm writing some code which needs to be compatible accross a Cortex-M based embedded device and x86 / x86_64 based PCs. I needed a solution for sending binary data between the Cortex-M and the ...
Venemo's user avatar
  • 243
5 votes
0 answers
2k views

Generic sliding window

The code implements fully generic sliding window with linear complexity. It should usually be paired with transforming iterator to reach full potential. Sliding window is a grouping of elements by ...
Incomputable's user avatar
  • 9,484
5 votes
0 answers
516 views

Intrusive weak pointer

WeakPtr can point to any object provided it inherits from WeakBase. So, for example, you could use it to observe an object ...
Taylor's user avatar
  • 287
5 votes
0 answers
723 views

Calculating complex exponential numbers using OpenMP in Cython

I am trying to create a function that can either beat numexpr or perform comparably for the vectorized mathematical operation ...
Trekkie's user avatar
  • 151
5 votes
0 answers
717 views

A full-duplex connection to an IRC server

This connection class can be used, through composition, to make IRC clients for different kinds of IRC services. ...
Francisco Aguilera's user avatar
5 votes
0 answers
1k views

Graph as adjacency lists: BFS DFS Topological Sort

I have written some code to practise graphs. Graph is represented as vector<list<int>> . Would you share some feedback with me? Are algorithms correct ...
tomtom's user avatar
  • 151
5 votes
0 answers
66 views

Using the llvm::iterator_adaptor_base

I'm currently working with the LLVM JIT framework. There is some graph I had to implement for internal cost bench-marking. It has cyclic node dependencies, so I have to use ...
Minor Threat's user avatar
5 votes
0 answers
204 views

Fake 3D effect in SFML - follow up 2

Based on my previous question, I have implemented all the recommendations received. In addition, i have implemented new features and completed road geometries. Here is a summary of the improvements: ...
MORTAL's user avatar
  • 3,278
5 votes
0 answers
2k views

Disruptor pattern in a lock-free producer-consumer queue

I'm implementing a quick-and-dirty lock-free MPMC queue in C++, based on the v3 Disruptor algorithm. The implementation is pretty simple: Data to be shared between threads is stored in a ring buffer. ...
linguamachina's user avatar
5 votes
0 answers
210 views

Text-based Snake game on Window - follow-up

Previous question: Text-based Snake game on Window Summary of improvements: Removed unnecessary functions such as clearScreen() Added new ...
MORTAL's user avatar
  • 3,278
5 votes
0 answers
1k views

C++ class "overload" using variadic templates and wrapped function pointers

I'm using C++11 and I have the following problem (pseudo C++): ...
jchnkl's user avatar
  • 51
5 votes
1 answer
116 views

Function outcome: consistent approach and easy logging

My goal is to make a consistent and easy way to determine how a function fails/succeeds. I'm looking for code review of my Status class for any bad practices, code ...
sazr's user avatar
  • 191

1
2 3 4 5
12