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.

620 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
  • 93.9k
9 votes
0 answers
526 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,046
8 votes
0 answers
833 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
302 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
544 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
341 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,275
8 votes
0 answers
349 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
331 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
8 votes
0 answers
3k views

constexpr Sin Function C++ 14

I have written a constexpr sin function using c++14 and would like to know what I can do to improve it. I am trying to balance code clarity/maintainability with ...
Alex Zywicki's user avatar
7 votes
0 answers
407 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
  • 659
7 votes
0 answers
206 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
222 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
952 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
477 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
238 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
  • 659
6 votes
0 answers
145 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
211 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
181 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
  • 93.9k
6 votes
0 answers
113 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
221 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
502 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
260 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
70 views

Small Automatic Differentiation Library

Introduction As a programming exercise I recently wrote this automatic differentiation library based on forward accumulation. It should offer a simple way to create mathematical functions whose ...
malphax's user avatar
  • 51
5 votes
0 answers
150 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
968 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
101 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
  • 8,724
5 votes
0 answers
83 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
44 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
  • 93.9k
5 votes
0 answers
72 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
  • 93.9k
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

Bubble sort in parallel

I have done bubble sort algorithm on a vector that is filled with randomly generated values. Bubble sort is actually done with odd-even transition method: ...
NutCracker's user avatar
5 votes
0 answers
979 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
  • 713
5 votes
0 answers
150 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
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
160 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
223 views

deep_ptr<T>; a header-only, deep copying, value semantic smart pointer for optionally defined types

Edit: final revision here A couple days ago I posted a similar question here. Since then, I have refined the implementation a bit further, as the solution I had previously posited was a bit off ...
Tom's user avatar
  • 405
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,374
5 votes
0 answers
487 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
708 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
692 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
202 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

1
2 3 4 5
13