QtPass 1.5.0 is out.
Modern C++17, combined with improved Qt support, add in fixes, cleanup, packaging work, CI and linting improvements, and updated translations.
Release notes: <https://github.com/IJHack/QtPass/releases/tag/v1.5.0>
#QtPass #Qt #CPP17 #ModernCpp #FOSS #PasswordStore
Screenshot of a code snippet containing two functions written in C++. The first function is called `CreateServiceProvider()` and uses a pattern closely resembling modern .NET dependency injectors. It calls `services.AddSingleton<>()` to register a `ProjectService` and a `ProjectDatabase`, then calls `MvvmServicesRegistrator::Register()` to automatically add the entire MVVM subsystem to the dependency injector. The second function is called `BindViewModels()` and grabs the `WindowManager` out of the dependency injector, then calls `BindViewModel<MainViewModel, MainWindow>()` to automatically associate the `MainViewModel` with the `MainWindow`. Later on, the application can simply instruct the `WindowManager` to display a window for the `MainViewModel` and it will figure out everything - which Qt Widgets main window class to use, which view model to construct and its constructor-injected dependencies, too - just like it would be in a modern .NET environment.
That was easier than I thought.
Simple WindowManager class, one-line View <-> ViewModel binding, view model is constructed through dependency injector, so just adding services as constructor parameters provides them to the view model with no other change :)
#cxx #programming #moderncpp
Screenshot of a unit test that serves as example of the C++ dependency injector. At the top, it creates a `StandardServiceCollection` and calls `AddSingleton<Interface, Implementation>()` on it to register two services. The constructor arguments of the `Implementation` classes are automatically detected via template magic. It then calls `BuildServiceProvider()` on the `StandardServiceCollection` to produce a `ServiceProvider` instance. From this instance, it requests one of the registered services (by its interface) and calls a method on that demonstrates that other service, which it depends on through the implementaiton class' constructor arguments, had been provided to the constructor when it was called (recursive dependency resolution).
My C++20 dependency injector rewrite is coming along.
It's loosely inspired by Microsoft.Extensions.DependencyInjection, with a ServiceCollection, .AddSingleton<Ifc,Impl>(), service scopes, automatic constructor argument detection, all done in pure C++20.
#programming #moderncpp #templates
Screenshot of a C++20 code snippet that registers an entity class for a database table: ``` r.RegisterTable<TestEntity>(u8"users"). WithColumn<&TestEntity::Id>(u8"id").NotNull().AutoGenerated().PrimaryKey(). WithColumn<&TestEntity::Name>(u8"name").NotNull(). WithColumn<&TestEntity::PasswordHash>(u8"passwordHash"); ```
Screenshot of a C++20 code snippet that executes a "fluent" query on a database table using a registered entity class: ``` std::optional<User> johnUser = myProjectDataContext.Users. Where(Column(&User::Name) == u8"John")). SingleOrDefault(); ```
The neat "mini" ORM for C++20 I started recently turned out very well and is already seeing use :)
github.com/nuclex-share...
The registration of entity classes is very easy now, too. Just the fluent query system and a packageable CMake build remain.
#programming #cxx #cplusplus #moderncpp
Channel9 Should people move old C++ to modern C++? #CPlusPlus #ModernCPP #DeveloperSecurity
Explore the latest advances in modern C++ programming! Understand new features, improved performance, and practical implications for developers. Tap into powerful tools for more efficient coding. #CPlusPlus #ModernCpp
C++ fragments using requires clause with front and tail syntax. ```C++ template<typename... Ts> requires((std::constructible_from<QStringView, Ts> || std::constructible_from<QLatin1String, Ts>) && ...) static void reportError(QStringView format, Ts &&...args) ``` ```C++ template<typename... Ts> static void reportError(QStringView format, Ts &&...args) requires((std::constructible_from<QStringView, Ts> || std::constructible_from<QLatin1String, Ts>) && ...) { ```
I am pretty sure you all already know, but it's actually possible to have `requires` clauses at the end of a function declaration. Just like any other attribute.
This makes usage of ad-hoc requirements much more readable and greatly reduces the pressure to […]
[Original post on mastodon.green]
You don't realize just how good C++23 is until you take some old C++ code, paste it into #Godbolt, set the compiler flags to C++23, add a few concept-checking asserts, read the beautifully clear error messages from concepts, and fix your problem.
#ModernCPP #CPP #Concepts #Legacy #Evolution […]
Owning and non-owning C++ Ranges 2025-05-17 16 min read This is the first article in a series discussing some of the underlying properties of C++ ranges and in particular range adaptors. At the same time, I introduce the design of an experimental library which aims to solve some of the problems discussed here.
I wrote a blog post:
𝗢𝘄𝗻𝗶𝗻𝗴 𝗮𝗻𝗱 𝗻𝗼𝗻-𝗼𝘄𝗻𝗶𝗻𝗴 𝗖++ 𝗥𝗮𝗻𝗴𝗲𝘀
The first article in a series discussing some of the underlying properties of C++ ranges, and in particular range adaptors.
hannes.hauswedell.net/post/2025/05...
#cplusplus #moderncpp #programming #cpp #ranges
Templates in C++ are powerful – but they’re also one of the most misunderstood features.
Ready to rewind, revisit, and truly master templates on your term? Book before April 30th and get a free copy of my "Tips and Tricks with Templates" book.
#programming #cpptemplates #ModernCpp
C++ Is 45 Years Old. [Stroustrup] Says You Still Don’t Get It!
hackaday.com/2025/02/09/c...
#CPlusPlus #C++ #45Years #Stroustrup #Wisdom #ModernCPP #CodeLegacy #Programming #Evolution #DevLife #Software #Engineering
Improve code safety and efficiency with "Modern C++ Paradigms" at the KDAB Training Day (8 May). This one-day training course covers value semantics, modern error handling, range-based programming, and more. Early bird tickets on training.kdab.com/ktd25/ #Cpp #ModernCpp #CPlusPlus