-
Stay up-to-date with everything C++! Content directly fetched from the subreddit just for you. Join our group for discussions : @programminginc Powered by : @r_channels
vcpkg and versioning (esp. with multiple commits)
Hi, I'm trying to understand how versioning works in vcpkg running in a CI.
I know about the vcpkg's classic mode of checking out a specific vcpkg commit and having a central repository of installed packages in the vcpkg folder.
I'd like to understand manifest mode since it's the reccomended one nowadays and in fact, I'd like to be able to update the dependencies depending which commit of my code gets built in the CI.
Other dependencies manager, like NuGet, Rust's Cargo and Conan for C++, have the tool version that can be always kept up to date and a local file that specify the dependencies your project need. When invoking the tool, the deps gets fetched and prepared accordingly. So, you can have the latest nuget / cargo / conan (2) and fetch / build newer or older deps.
How does this work with vcpkg in manifest mode? I've read about the builtin-baseline option but I don't understand what happens if the vcpkg folder is newer or older than that.
I'm also interested in understanding what happens when there's the need to create an hotfix to an older version (possibly using a different package versions and a different baseline). Because it's impossible to ask for the CI to switch the vcpkg folder's commit before any build...
Thanks.
https://redd.it/1lfywfk
@r_cpp
how to move value from unique_ptr<T> to another T t and transfer ownership?
T is movable. Don't copy the T data.
https://redd.it/1lfrjdh
@r_cpp
Learning modern DirectX 11
While learning d3d11, it has come to my notice that microsoft constantly updated directx all the way to version 11.4. Where can I learn "modern" d3d11? All the examples and tutorials I see are targeted towards "old" d3d11. I understand that d3d12 is a thing but I am not ready for it yet. Thanks in advance!
https://redd.it/1lfiebd
@r_cpp
Kourier vs Lithium: The Fully-Compliant Server is Also the Fastest
https://blog.kourier.io/posts/kourier-vs-lithium-the-fully-compliant-server-is-also-the-fastest
https://redd.it/1lf8ziv
@r_cpp
Sourcetrail (Fork) 2025.6.19 released
Hi everybody,
[Sourcetrail 2025.6.19](https://github.com/petermost/Sourcetrail/releases/tag/2025.6.19), my **fork** of the C++/Java source explorer, has been released with these changes:
* GUI: Allow removing projects from the `Recent Projects` list
* GUI: Fix highlighting of `Text` and `On-Screen` search results for UTF-16/UTF-32 text
* GUI: Show configured text encoding in the status bar
* Internal: Switch to ['UTF-8 Everywhere'](https://utf8everywhere.org/)
* Internal: Switch to Qt resource system for most GUI resources
https://redd.it/1lf8y81
@r_cpp
Crowcpp mustache templates NOT FOUND
I have the code:
crow::SimpleApp app;
auto template_text = crow::mustache::load("rates.html");
CROW_ROUTE(app, "/")([&](){
//some stuff
});
CROW_ROUTE(app, "/").methods("POST"_method)([&](const crow::request& req){
auto res = crow::response(303);
res.set_header("Location", "/");
return res;
});
app.port(18080)
.multithreaded()
.run();
After running it shows me the next line
`(2025-05-30 19:01:10) [WARNING ] Template "rates.html" not found.`
File "rates.html" placed in same directory with exe. I tried to set fullpath and ./rates.html path, but warning still same and I get blank page. How can I fix it? What am I doing wrong?
https://redd.it/1kzcsjt
@r_cpp
How to know what methods use popular in every topic like stl, list, .... ?
https://redd.it/1kz4olo
@r_cpp
Suggestion on (re)learning C++ development in 2025?
A bit of context: I've being programming for more than a decade, but my only professional experience is with C#/Javascript/Python. Last time I touched C++, unique_ptr was still a very new thing. I know what reference counting and RAII are, but that practically where my understanding of C++ ends.
If I'd like to hone my C++ skill and get myself familiar with modern C++ eco system, where should I start? I'm not talking about the syntax, but the state of modern toolchain: which version should I use? Do I need to learn from C++11 -> C++17 -> C++23 or I can just jump in C++23 directly? Which building system and package manager should I use, if any? Is there a more or less 'managed' development environment where I can set breakpoint and inspect objects like C#/Java? Stuff like that.
(My current goal is to learn SDL3 development, but for the sake of generality I don't want to limit this question to SDL3.)
https://redd.it/1kz1seu
@r_cpp
If you had 3 weeks to refresh C++ for an interview what would you approach that with ?
How would you brush up asap ? Curiousity only
https://redd.it/1kypfms
@r_cpp
Boost.Bloom by Joaquín M López Muñoz has been accepted!
Classical, block and multiblock Bloom filters, and more. Thanks to Review Manager Arnaud Becheler.
Announcement: https://lists.boost.org/Archives/boost/2025/05/259631.php
Repo: https://github.com/joaquintides/bloom
Docs: https://master.bloom.cpp.al
https://redd.it/1kyfjda
@r_cpp
easiest than iostream
I am a beginner program of c++ please, PLEASE ANY ONE HAVE A LIBRARY EASIEST THAN IOSTREAM
https://redd.it/1ky6mg4
@r_cpp
Boost.OpenMethod by Jean-Louis Leroy has been accepted!
Virtual and multiple dispatch of functions defined out of the target classes. Thanks to Review Manager Dmitry Arkhipov.
Repo: https://github.com/jll63/Boost.OpenMethod/tree/master
Docs: https://jll63.github.io/Boost.OpenMethod/
https://redd.it/1kxq689
@r_cpp
C/C++ console game library
Hi! I'm looking for a C/C++ library that will allow me to create a simple 2D OR 3D console game (not a text game, just a regular one, but in the terminal).
https://redd.it/1kxmqf3
@r_cpp
I can't understand inheritnace C++ and Polyphirms guys
https://redd.it/1kxemdr
@r_cpp
#pragma omp for reduction(max:maxres) schedule(static)
for (i = 1; i < NX-1; ++i){
for (j = 1; j < NY-1; ++j){
residual[i][j] = 0.25 * (
phi_new[i + 1][j] + phi_new[i - 1][j] +
phi_new[i][j + 1] + phi_new[i][j - 1]) - phi_new[i][j];
maxres = std::max(maxres, std::abs(residual[i][j]));
}
}
}
if (iter % 100 == 0)
std::cout << "Iter: " << iter << " maxres: " << maxres << "\n";
if (maxres < TOL)
break;
}
double end_time = omp_get_wtime();
std::cout << "Time taken (seconds): " << end_time - start_time << "\n";
return 0;
}
https://redd.it/1kx89hx
@r_cpp
Revisiting Knuth’s “Premature Optimization” Paper
https://probablydance.com/2025/06/19/revisiting-knuths-premature-optimization-paper/
https://redd.it/1lfyjyu
@r_cpp
tabular - a lightweight, header-only C++ library for creating well-formatted, fully-customizable CLI tables.
Recently, I had some project ideas that required a table formatting library. I searched for existing solutions and found tabulate, the most popular option, but encountered several issues like locale-dependent handling of multi-byte characters, weak support for dynamic/irregular tables, and some Windows-specific bugs (though I'm now on Linux).
I decided to write my own implementation that addresses these problems. tabular is a locale-independent, lightweight, header-only C++ library for table formatting. Based on my testing, it works properly on Windows (though my testing there was limited since I'm primarily on Linux). I'd love to share it here and get your feedback.
https://redd.it/1lfnbh1
@r_cpp
Alex Loiko: Fractals on the GPU
https://youtu.be/PMDIDcBu3V0
https://redd.it/1lfba0o
@r_cpp
Why can't Contracts be removed without blocking C++26?
In recent video Audience Bjarne says he is considering voting against C++26 because of contacts, but he is torn because C++26 has some a lot of nice things.
transcript(typed by me, feel free to correct if I misheard anything)
Bjarne Stroustrup:
>So go back about one year, and we could vote about it before it got into the standard, and some of us voted no. Now we have a much harder problem. This is part of the standard proposal. Do we vote against the standard because there is a feature we think is bad? Because I think this one is bad. And that is a much harder problem. People vote yes because they think: "Oh we are getting a lot of good things out of this.", and they are right. We are also getting a lot of complexity and a lot of bad things. And this proposal, in my opinion is bloated committee design and also incomplete.
Can somebody explain to me why contracts can not just be taken out without the drama of blocking C++26?
I am mostly asking about WG21 procedures. I'm not primarily looking for political speculation, though if someone has insight on that side of things, feel free to share.
https://redd.it/1lf9qov
@r_cpp
Odd conversion rule: The case of creating new instances when you wanted to use the same one
https://devblogs.microsoft.com/oldnewthing/20250529-00/?p=111228
https://redd.it/1kzdxfx
@r_cpp
JIT Code Generation with AsmJit and AsmTk (Wednesday, June 11th)
Next month's Utah C++ Programmers meetup will be talking about JIT code generation using the AsmJit/AsmTk libraries:
https://www.meetup.com/utah-cpp-programmers/events/307994613/
https://redd.it/1kz9bwr
@r_cpp
CppCast: From Refactoring to (physical) Relocation
https://cppcast.com/from_refactoring_to_physical_relocation/
https://redd.it/1kz2qz6
@r_cpp
Creating Method-Coverage reports based on Line-Coverage reports
So, assuming that I have a Cobertura XML report (or an lcov, or equivalent) that contains metadata about line coverage but nothing regarding method/function coverage, is there any tool that allows me to use the source code files and interpolate them with the line coverage report to generate the method-coverage?
I know that this would likely be language-dependent, so that's why I'm posting on the C++ forum.
I'm looking for a way to avoid compiler-based solutions and only use source-code and live coverage.
Of course I can do this manually, but my project is big and that's why I'm looking to automate it. I have also tried some AI but it does not make a good job at matching lines of coverage. Any ideas?
https://redd.it/1kyrs2s
@r_cpp
IPC-Call C++ framework for IPC call
The IPC-Call framework allows calling a C++ server function from a C++ client in the same way as it is called locally https://github.com/amarmer/IPC-Call/tree/main
Comments and suggestions are welcome!
https://redd.it/1kykryw
@r_cpp
FLOX - C++ framework for building trading systems
Hi, dear subredditors.
On past weekend finished my trading infrastructure project that I started a few months ago. I named it FLOX. It is written in pure C++ (features from 20 standard used) and consists of building blocks that, in theory, allow users to build trading-related applications: hft systems, trading systems, market data feeds or even TradingView analog.
Project is fully open-source and available at github: https://github.com/eeiaao/flox
There are tests and benchmarks to keep it stable. I tried to document every component and shared high-level overview of this framework in documentation: https://eeiaao.github.io/flox/
Main goal of this project is to provide a clean, robust way to build trading systems. I believe my contribution may help people that passioned about low latency trading systems to build some great stuff in a systematic way.
I already tried to use it to build hft tick-based strategy and I was impressed how easy it scaling for multiple tickers / exchanges.
C++ knowledge is required. I have some thoughts on embedding JS engine to allow write strategies in JavaScript, but that's for the future.
Project is open to constructive criticism. Any contributions and ideas are welcome!
https://redd.it/1kya8ab
@r_cpp
Three types of name lookups in C++
https://www.sandordargo.com/blog/2025/05/28/three-ways-of-name-lookups
https://redd.it/1ky2vdu
@r_cpp
Using std::cpp Keynote: C++: The Balancing Act of Power, Compatibility, and Safety - Juan Alday
https://www.youtube.com/watch?v=jIE9UxA_wiA
https://redd.it/1kxoziz
@r_cpp
Kourier: the fastest server for building web services is open source and written in C++/Qt
https://github.com/kourier-server/kourier
https://redd.it/1kxfx6s
@r_cpp
gsl-lite v1.0 released
https://github.com/gsl-lite/gsl-lite
Release notes: https://github.com/gsl-lite/gsl-lite/releases
*gsl-lite* is an implementation of the C++ Core Guidelines Support Library originally based on Microsoft GSL.
Main changes in v1.0:
- gsl-lite now lives in namespace gsl_lite and no longer defines Expects() and Ensures() (use gsl_Expects(), gsl_Ensures() instead). This means gsl-lite can now coexist with Microsoft GSL.
- We borrowed the span<> implementation from Microsoft GSL which has static extents and a checked iterator.
- Sane defaults are now the default :)
We also have more documentation now.
gsl-lite v1.0.1 is available via Vcpkg, a PR to Conan Center is currently pending.
https://redd.it/1kxbbw8
@r_cpp
variable)
Kokkos::parallel_reduce("MaxResidual",
Kokkos::MDRangePolicy<Kokkos::Rank<2>>({1, 1}, {NY - 1, NX - 1}),
[=] KOKKOS_FUNCTION (const int j, const int i, double& local_maxres) { // j: y-index, i: x-index
double point_residual_val = Kokkos::fabs(
0.25 * (P_new(i + 1, j) + P_new(i - 1, j) +
P_new(i, j + 1) + P_new(i, j - 1)) -
P_new(i, j)
);
if (point_residual_val > local_maxres) {
local_maxres = point_residual_val;
}
}, Kokkos::Max<double>(maxres)); // Kokkos::Max reducer updates host variable 'maxres'
Kokkos::fence("ResidualCalculationComplete");
if (iter % 100 == 0) {
std::cout << "Iter: " << iter << " maxres: " << maxres << std::endl;
}
if (maxres < TOL) {
break; // Exit loop if converged
}
std::swap(phi_current_ptr, phi_next_ptr);
}
Kokkos::fence("SolverLoopComplete");
double end_time = timer.seconds();
std::cout << "Time taken (seconds): " << end_time << std::endl;
}
Kokkos::finalize();
return 0;
}
The OpenMP code: Takes between 1.2-2.5 seconds on my PC with 16 OMP threads
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <omp.h>
#define NX (128 * 8 + 2)
#define NY (128 * 6 + 2)
#define MAX_ITER 10000
#define TOL 1.0e-6
#define DX (1.0 / (NX - 1))
#define DY (1.0 / (NY - 1))
int main() {
std::cout << "Start \n";
std::cout << "Nx="<<NX<<", NY="<<NY<<"\n";
double phi_old[NX][NY];
double phi_new[NX][NY];
double residual[NX][NY];
double maxres, diff;
int iter, i, j;
int num_threads = omp_get_max_threads();
std::cout << "Using " << num_threads << " OpenMP threads\n";
std::srand(static_cast<unsigned int>(std::time(nullptr)));
for (j = 0; j < NY; ++j)
for (i = 0; i < NX; ++i)
phi_old[i][j] = static_cast<double>(std::rand()) / RAND_MAX;
for (j = 0; j < NY; ++j)
for (i = 0; i < NX; ++i)
phi_new[i][j] = phi_old[i][j];
for (i = 0; i < NX; ++i) {
phi_old[i][0] = phi_old[i][NY - 1] = 0.0;
phi_new[i][0] = phi_new[i][NY - 1] = 0.0;
}
for (j = 0; j < NY; ++j) {
phi_old[0][j] = phi_old[NX - 1][j] = 0.0;
phi_new[0][j] = phi_new[NX - 1][j] = 0.0;
}
std::cout << "Start solving...\n";
double start_time = omp_get_wtime();
for (iter = 1; iter <= MAX_ITER; ++iter) {
maxres = 0.0;
#pragma omp parallel default(shared) private(i, j)
{
// phi_old=phi_new. Would be more efficient to switch pointers.
#pragma omp for schedule(static)
for (i = 0; i < NX; ++i)
for (j = 0; j < NY; ++j)
phi_old[i][j] = phi_new[i][j];
// Jacobi
#pragma omp for schedule(static)
for (i = 1; i < NX-1; ++i)
for (j = 1; j < NY-1; ++j)
phi_new[i][j] = 0.25 * (
phi_old[i + 1][j] + phi_old[i - 1][j] +
phi_old[i][j + 1] + phi_old[i][j - 1]);
// calculate Linf residue