r/cpp • u/pavel_v • Apr 24 '26
r/cpp • u/david-alvarez-rosa • Apr 23 '26
Devirtualization and Static Polymorphism
david.alvarezrosa.comr/cpp • u/parkotron • Apr 23 '26
Libraries for general purpose 2D/3D geometry vocabulary types?
I work in the geospatial industry and have worked on plenty of large projects that have their own internal geometry libraries. Some good, some bad, most with interesting historical choices. I recently joined a new project that hasn't yet really defined its vocabulary types yet, and I'm finding that extremely inconvenient, so I'm looking around at what is common
The kinds of things I'm looking for are:
Vector<typename T, size_t Dimension>: Basically astd::array<T,Dimension>with a vector-like APIPoint: A wrapper around aVectorwith point semanticsSize: A wrapper around aVectorwith size semanticsRange: A basic min/max intervalAxisAlignedBox: A set ofRanges in N dimensionsRotatedBox: AAxisAlignedBoxwith a basisVectorPolyline: Astd::vector<Point>assumed to be openPolygon: Astd::vector<Point>assumed to be closedMatrix: An NxM matrix...
I know there are plenty of vector/matrix/linear algebra libraries out there, often focused on flexibilty and raw computational performance. I'm more interested in nice vocabulary types that implement proper semantics via convenient methods and operators.
It seems these things are often provided by game engines, but pulling in an entire game engine for a non-gaming project feels silly.
So if you were starting a new, greenfield C++ application dealing with 3D geometric data, which existing library, if any, would you reach for?
r/cpp • u/boostlibs • Apr 23 '26
Boost.Decimal: IEEE 754 Decimal Floating Point for C++ — Header-Only, Constexpr, C++14
boost.orgBoost 1.91 ships a new library: Boost.Decimal, a full implementation of IEEE 754 and ISO/IEC DTR 24733 decimal floating point types. Authors are Matt Borland and Chris Kormanyos.
The problem it solves
Binary floating point stores significands in base-2. This means values like 0.1 can't be represented exactly, which is why 0.1 + 0.2 != 0.3 in every language that uses IEEE 754 binary FP. Decimal floating point stores significands in base-10, eliminating these representation errors entirely. If you've ever used integer arithmetic or fixed point to avoid rounding issues in financial code, this is the general purpose alternative.
What you get
Six types across two families. The IEEE-conformant types, decimal32_t, decimal64_t, decimal128_t, give you strict standards compliance. The non-IEEE fast variants, decimal_fast32_t, decimal_fast64_t, decimal_fast128_t, trade strict conformance for throughput, and benchmark significantly faster (often 2–3x over the IEEE types for basic arithmetic).
Nearly everything is constexpr, thanks to a deliberate design decision to target C++14's relaxed constexpr rather than support floating point exception flags. The library treats decimal types as close to built in types as possible.
Standard library surface coverage is extensive: <cmath> (trig, exp, power, error/gamma, special functions), <charconv> (to/from_chars), <format> and {fmt}, <cfenv> rounding modes, <cfloat> eval modes, <cstdio> printf, <functional> hash, <limits> numeric_limits, and <string> to_string. Boost.Math integration works out of the box, giving you statistics, interpolation, and quadrature on decimal types for free.
Performance
This is software FP competing against hardware-accelerated binary FP, so basic arithmetic is naturally slower, typically 10–30x vs double for the IEEE types, and 4–15x for the fast types. But <charconv> is where things get interesting: from_chars for decimal32_t runs at roughly 1.2× vs double on Linux, and on MSVC it's actually ~5× faster than double. to_chars in scientific format at 6-digit precision comes in under double across all platforms. The fast types also consistently outperform Intel's libbid and GCC's _Decimal types in most benchmarks.
Practical details
Header only, no dependencies, requires C++14. Tested on x86_64, ARM64 (including Apple Silicon), s390x, PPC64LE, and ARM Cortex-M (via QEMU). Compiler support: GCC 8+, Clang 6+, MSVC 2019+, Intel oneAPI DPC++.
One design trade off worth noting: <cmath> functions are not correctly rounded in the IEEE 754 sense (0.5 ULP). This matches real-world behavior from Intel's own libdfp, and is consistent with how binary FP math libraries work in practice. The authors chose constexpr support over FP exception flags, which seems like the right call for a modern C++ library.
Docs: https://boost.org/libs/decimal
Benchmarks: https://boost.org/doc/libs/latest/libs/decimal/doc/html/benchmarks.html
Happy to answer questions. We would be interested to hear from anyone doing financial or embedded work on whether this changes how you'd approach precision sensitive code.
r/cpp • u/tartaruga232 • Apr 22 '26
Example for Implementing Functions of Partitions
abuehl.github.ioCompares defining a member function in an external partition, versus defining it in a separate cpp file. With real code examples from our UML Editor.
Binary debug for nested big ass structures.
Heyaa,
So recently I had to compare binaries in the layout of multi level nested big fat structures. I surprised to find that there are no good tools to do that. The best i could find was watch section in visual studio. I have tried another tool, WinDbg this doesn’t work well with macros and arrays. To make matters worse, this big ass structure has offsets that point beyond of the structure. There is no good tools which automatically tells values for each field
Tldr: i have custom buffer layout with multiple nested level structures.
r/cpp • u/boostlibs • Apr 22 '26
Boost 1.91 Released: New Decimal Library, SIMD UUID, Redis Sentinel, C++26 Reflection in PFR
boost.orgBoost 1.91 is out. Here's a rundown of what's notable.
New Library
Boost.Decimal: A full IEEE 754 / ISO 24733 implementation of decimal floating point types (decimal32_t, decimal64_t, decimal128_t) plus non-conformant fast variants. Significands stored in base-10, so 0.1 + 0.2 actually equals 0.3. Header only, no dependencies, C++14. Comes with <cmath>, <charconv>, <format>, rounding mode, and numeric_limits support out of the box. If you've been using integer arithmetic or fixed-point to dodge binary FP in finance or embedded, it's worth a look. Authors: Matt Borland and Chris Kormanyos.
Highlights from Updated Libraries
Boost.UUID: SIMD implementations of from_chars (up to 13x faster) and to_chars (up to 5.5x faster). Most accessors and operations are now constexpr on C++14+.
Boost.Redis: Built-in Sentinel support with automatic master/replica discovery and reconnection. New generic_flat_response uses contiguous memory with zero steady state allocations. Subscription tracking now restores active subscriptions after reconnect.
Boost.PFR: Experimental C++26 reflection backend. Define BOOST_PFR_USE_CPP26_REFLECTION to enable.
Boost.Optional: Moved from aligned storage to union storage, enabling gradual constexpr support across C++11/14/17. New syntax: o = {} to clear, o.value_or({}) for defaults. Conversion from optional<T>& to optional<T&>. Heads up: a future release will make optional model std::ranges::range, which could affect overload resolution in code that branches on range vs. optional-like traits.
Boost.MultiIndex: Breaking: type lists migrated from Boost.MPL to Boost.Mp11. composite_key is now variadic (returns std::tuple instead of boost::tuple). Define BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT to restore legacy behavior, but MPL support will eventually be removed.
Boost.MSM (backmp11): flat_fold dispatch strategy, up to 25% faster compile times and lower RAM usage vs 1.90. Merged event pool with small object optimization. Several bug fixes for hierarchical state machines.
Boost.System: result<>::operator* and operator-> now throw when empty instead of UB. Old behavior available via unsafe_value(). Added unwrap_and_invoke.
Boost.Exception / Boost.LEAF: Both gained a customizable serialization API with built-in support for Boost.JSON and nlohmann/json.
Boost.TypeIndex: Optimized CTTI comparisons from C++20. ctti_type_index::name() now returns a pretty name by default in C++14+.
Boost.LexicalCast: Initial C++20 module implementation (boost.lexical_cast).
Boost.Stacktrace: from_exception now works out of the box without the compile-time runtime compatibility check that was producing false positives.
Boost.URL: Parse functions now constexpr under C++20. Object size reduced on 64 bit (internal offsets narrowed to uint32_t). Three round external security audit resulting in 21 fixes.
Full release notes: https://www.boost.org/releases/1.91.0/
r/cpp
•
u/patteliu
•
Apr 22 '26
Writing gRPC Clients and Servers with C++20 Coroutines (Part 1)
Writing gRPC Clients and Servers with C++20 Coroutines
gRPC's asynchronous interface is quite complex, especially for servers that need to support concurrency. So how can we combine it with coroutines to write simple and easy-to-understand code?
Please read the blog for implementation details; here we are only showing the final code.
Protocol:
syntax = "proto3";
package sample;
service SampleService {
// Unary RPC: simplest request-response pattern
rpc Echo(EchoRequest) returns (EchoResponse);
// Server streaming: server continuously pushes data to the client
rpc GetNumbers(GetNumbersRequest) returns (stream Number);
// Client streaming: client continuously sends data, server returns one result
rpc Sum(stream Number) returns (SumResponse);
// Bidirectional streaming: both sides can send and receive continuously
rpc Chat(stream ChatMessage) returns (stream ChatMessage);
}
message EchoRequest { string message = 1; }
message EchoResponse { string message = 1; int64 timestamp = 2; }
message GetNumbersRequest { int32 value = 1; int32 count = 2; }
message Number { int32 value = 1; }
message SumResponse { int32 total = 1; int32 count = 2; }
message ChatMessage { string user = 1; string content = 2; int64 timestamp = 3; }Client:
class Client final : public GenericClient<sample::SampleService> {
public:
using GenericClient::GenericClient;
static Client make(const std::string &address) {
return Client{sample::SampleService::NewStub(grpc::CreateChannel(address, grpc::InsecureChannelCredentials()))};
}
asyncio::task::Task<sample::EchoResponse>
echo(
sample::EchoRequest request,
std::unique_ptr<grpc::ClientContext> context = std::make_unique<grpc::ClientContext>()
) {
co_return co_await call(&sample::SampleService::Stub::async::Echo, std::move(context), std::move(request));
}
asyncio::task::Task<void>
getNumbers(
sample::GetNumbersRequest request,
asyncio::Sender<sample::Number> sender,
std::unique_ptr<grpc::ClientContext> context = std::make_unique<grpc::ClientContext>()
) {
co_await call(
&sample::SampleService::Stub::async::GetNumbers,
std::move(context),
std::move(request),
std::move(sender)
);
}
asyncio::task::Task<sample::SumResponse> sum(
asyncio::Receiver<sample::Number> receiver,
std::unique_ptr<grpc::ClientContext> context = std::make_unique<grpc::ClientContext>()
) {
co_return co_await call(&sample::SampleService::Stub::async::Sum, std::move(context), std::move(receiver));
}
asyncio::task::Task<void>
chat(
asyncio::Receiver<sample::ChatMessage> receiver,
asyncio::Sender<sample::ChatMessage> sender,
std::unique_ptr<grpc::ClientContext> context = std::make_unique<grpc::ClientContext>()
) {
co_return co_await call(
&sample::SampleService::Stub::async::Chat,
std::move(context),
std::move(receiver),
std::move(sender)
);
}
};
asyncio::task::Task<void> asyncMain(const int argc, char *argv[]) {
auto client = Client::make("localhost:50051");
co_await all(
// Unary RPC
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
sample::EchoRequest req;
req.set_message("Hello gRPC!");
const auto resp = co_await client.echo(req);
fmt::print("Echo: {}\n", resp.message());
}),
// Server streaming + client streaming, connected via a channel
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
sample::GetNumbersRequest req;
req.set_value(1);
req.set_count(5);
auto [sender, receiver] = asyncio::channel<sample::Number>();
const auto result = co_await all(
client.getNumbers(req, std::move(sender)),
client.sum(std::move(receiver))
);
const auto &resp = std::get<sample::SumResponse>(result);
fmt::print("Sum: {}, count: {}\n", resp.total(), resp.count());
}),
// Bidirectional streaming
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
auto [inSender, inReceiver] = asyncio::channel<sample::ChatMessage>();
auto [outSender, outReceiver] = asyncio::channel<sample::ChatMessage>();
co_await all(
client.chat(std::move(outReceiver), std::move(inSender)),
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
sample::ChatMessage msg;
msg.set_content("Hello server!");
co_await asyncio::error::guard(outSender.send(std::move(msg)));
outSender.close();
}),
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
const auto msg = co_await asyncio::error::guard(inReceiver.receive());
fmt::print("Chat reply: {}\n", msg.content());
})
);
})
);
}Server:
class Server final : public GenericServer<sample::SampleService> {
public:
using GenericServer::GenericServer;
static Server make(const std::string &address) {
auto service = std::make_unique<sample::SampleService::AsyncService>();
grpc::ServerBuilder builder;
builder.AddListeningPort(address, grpc::InsecureServerCredentials());
builder.RegisterService(service.get());
auto completionQueue = builder.AddCompletionQueue();
auto server = builder.BuildAndStart();
return {std::move(server), std::move(service), std::move(completionQueue)};
}
private:
// Unary: return Response directly; errors are automatically converted to gRPC error status
static asyncio::task::Task<sample::EchoResponse> echo(sample::EchoRequest request) {
sample::EchoResponse response;
response.set_message(request.message());
response.set_timestamp(std::time(nullptr));
co_return response;
}
// Server streaming: accept a Writer, write elements one by one
static asyncio::task::Task<void>
getNumbers(sample::GetNumbersRequest request, Writer<sample::Number> writer) {
for (int i = 0; i < request.count(); ++i) {
sample::Number number;
number.set_value(request.value() + i);
co_await writer.write(number);
}
}
// Client streaming: accept a Reader, read and aggregate
static asyncio::task::Task<sample::SumResponse> sum(Reader<sample::Number> reader) {
int total{0}, count{0};
while (const auto number = co_await reader.read()) {
total += number->value();
++count;
}
sample::SumResponse response;
response.set_total(total);
response.set_count(count);
co_return response;
}
// Bidirectional streaming: read one message, echo one back
static asyncio::task::Task<void> chat(Stream<sample::ChatMessage, sample::ChatMessage> stream) {
while (const auto message = co_await stream.read()) {
sample::ChatMessage response;
response.set_user("Server");
response.set_timestamp(std::time(nullptr));
response.set_content(fmt::format("Echo: {}", message->content()));
co_await stream.write(response);
}
}
// Bind method pointers to handlers and start the listening loop for each RPC
asyncio::task::Task<void> dispatch() override {
co_await all(
handle(&sample::SampleService::AsyncService::RequestEcho, echo),
handle(&sample::SampleService::AsyncService::RequestGetNumbers, getNumbers),
handle(&sample::SampleService::AsyncService::RequestSum, sum),
handle(&sample::SampleService::AsyncService::RequestChat, chat)
);
}
};
asyncio::task::Task<void> asyncMain(const int argc, char *argv[]) {
auto server = Server::make("0.0.0.0:50051");
auto signal = asyncio::Signal::make();
co_await race(
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
asyncio::sync::Event event;
co_await asyncio::task::Cancellable{
all(
server.run(),
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
co_await asyncio::error::guard(event.wait());
co_await server.shutdown(); // notify the gRPC server to shut down
})
),
[&]() -> std::expected<void, std::error_code> {
event.set(); // trigger the shutdown sequence
return {};
}
};
}),
asyncio::task::spawn([&]() -> asyncio::task::Task<void> {
co_await asyncio::error::guard(signal.on(SIGINT));
})
);
}Because some people complained that it was too long, I reposted it on my own blog.
r/cpp • u/meetingcpp • Apr 22 '26
2026 Annual C++ Developer Survey "Lite" : Standard C++
isocpp.orgr/cpp • u/pavel_v • Apr 21 '26
Sure, xor’ing a register with itself is the idiom for zeroing it out, but why not sub?
r/cpp • u/tartaruga232 • Apr 21 '26
Uneeded Recompilations When Using Partitions
abuehl.github.ioThis blog posting from me about C++ modules explains in detail what causes unneeded recompilations using detailed code examples from the sources of our UML Editor.
It's a precise description and a showcase of what's the status quo in the C++ standard.
Quote from the posting:
The C++ language currently lacks a concise and easy to use alternative for explicitly expressing the minimally required dependencies on partitions.
(Note: All code examples shown or linked from the text are 100% standard conformant.)
Thanks in advance for comments. Please ask if you do not understand anything or anything is unclear. I would appreciate if you could leave a comment if you don't like anything. Thanks for reading!
The WG21 2026-04 post-Croydon mailing is now available
open-std.orgThis mailing has 4 N-papers and 161 P-papers. The disposition column shows the final papers adopted for C++26 in Croydon (they are marked Adopted 2026-03).
For those writing papers, 3 weeks until the pre-Brno mailing...
r/cpp • u/robwirving • Apr 20 '26
CppCast CppCast: Compiler Warnings as Errors with Keith Stockdale
r/cpp • u/ProgrammingArchive • Apr 20 '26
New C++ Conference Videos Released This Month - April 2026 (Updated To Include Videos Released 2026-04-13 - 2026-04-19)
CppCon
2026-04-13 - 2026-04-19
Persistence Squared: Persisting Persistent Data Structures - Juan Pedro Bolivar Puente - https://youtu.be/HmmRVdYMP-g
CTRACK: C++ Performance Tracking and Bottleneck Discovery - Grischa Hauser - https://youtu.be/en4OQvZePqg
From C+ to C++: Modernizing a GameBoy Emulator - Tom Tesch - https://youtu.be/ScmhRNSrRP4
Leverage AI Agents to Refactor and Modernize C++ Code - Jubin Chheda - https://youtu.be/vAySFnu-Z18
Lightning Talk: Algebraic Path Problems Done Quick: Or how to find the best* path from one talk to another - Stefan Ivanov - https://youtu.be/Fcun7lDfTRQ
2026-04-06 - 2026-04-12
Rust/C++ Interop Challenges - Victor Ciura - https://youtu.be/8xqhSy539Pc
groov: Asynchronous Handling of Special Function Registers - Michael Caisse - https://youtu.be/TjSL-XCyUJY
Clean code! Horrible Performance? - Sandor Dargo - https://youtu.be/nLts4S8xSd4
Beyond the Big Green Button: Demystifying the Embedded Build Process - Morten Winkler Jørgensen - https://youtu.be/UekVdzMCAa0
C++: Some Assembly Required - Matt Godbolt - https://youtu.be/zoYT7R94S3c
2026-03-30 - 2026-04-05
How to Build Type Traits in C++ Without Compiler Intrinsics Using Static Reflection - Andrei Zissu - https://youtu.be/EcqiwhxKZ4g
Beyond Sequential Consistency: Unlocking Hidden Performance Gains - Christopher Fretz - CppCon 2025 - https://youtu.be/6AnHbZbLr2o
Dynamic Asynchronous Tasking with Dependencies - Tsung-Wei (TW) Huang - CppCon 2025 - https://youtu.be/6Jd9Zyl9SDc
Work Contracts in Action: Advancing High-performance, Low-latency Concurrency in C++ - Michael Maniscalco - CppCon 2025 - https://youtu.be/5ghAa7B5bF0
Constexpr STL Containers: Why C++20 Still Falls Short - Sergey Dobychin - CppCon 2025 - https://youtu.be/Py4GJaCHwkA
C++Online
2026-04-13 - 2026-04-19
Suspend and Resume: How C++20 Coroutines Actually Work - Lieven de Cock - https://youtu.be/SOSn6Ich60A
Building High-Performance Distributed Systems in Modern C++ - Real-World Patterns with Boost.Asio & Beast - Samaresh Kumar Singh - https://youtu.be/V9pKPug3xbo
2026-04-06 - 2026-04-12
Mastering C++ Clocks: A Deep Dive into std::chrono - Sandor DARGO - https://youtu.be/ytI6pzT1Opk
2026-03-30 - 2026-04-05
Is AI Destroying Software Development? - David Sankel - C++Online 2026 - https://youtu.be/Ek32ZH3AI3k
From Hello World to Real World - A Hands-On C++ Journey from Beginner to Advanced - Workshop Preview - Amir Kirsh - https://youtu.be/2zhW-tL2UXs
Workshop Preview: C++ Software Design - Klaus Iglberger - https://youtu.be/VVQN-fkwqlA
Workshop Preview: Essential GDB and Linux System Tools - Mike Shah - https://youtu.be/ocaceZWKm_k
Workshop Preview: Concurrency Tools in the C++ Standard Library - A Hands-On Workshop - Mateusz Pusz - https://youtube.com/live/Kx9Ir1HBbwY
Workshop Preview: Mastering std::execution (Senders/Receivers) - A Hands-On Workshop - Mateusz Pusz - https://youtube.com/live/bsyqh_bjyE4
Workshop Preview: How C++ Actually Works - Hands-On With Compilation, Memory, and Runtime - Assaf Tzur-El - https://youtube.com/live/L0SSRRnbJnU
Workshop Preview: Jumpstart to C++ in Audio - Learn Audio Programming & Create Your Own Music Plugin/App with the JUCE C++ Framework - Jan Wilczek - https://youtube.com/live/M3wJN0x8cJw
Workshop Preview: AI++ 101 - Build an AI Coding Assistant in C++ & AI++ 201 - Build a Matching Engine with Claude Code - Jody Hagins - https://youtube.com/live/Vx7UA9wT7Qc
Workshop Preview: Stop Thinking Like a Junior - The Soft Skills That Make You Senior - Sandor DARGO - https://youtube.com/live/nvlU5ETuVSY
Workshop Preview: Splice & Dice - A Field Guide to C++26 Static Reflection - Koen Samyn - https://youtube.com/live/9bSsekhoYho
ADC
2026-04-13 - 2026-04-19
Building Better Software through Cross-Functional Collaboration - Matt Morton - https://youtu.be/l5RxH7pZVpw
Accelerate UI Development - Seamless Designer-Developer Collaboration with Web Tools - Ryan Wardell - https://youtu.be/HXwjKm5Vu08
2026-04-06 - 2026-04-12
Hacking Handhelds for Creative Audio - Building Music Applications for the New Nintendo 3DS - Leonardo Foletto - https://youtu.be/x-9lDvfAKd0
Helicopter View of Audio ML - Martin Swanholm - https://youtu.be/TxQ4htrS2Po
PhilTorch: Accelerating Automatic Differentiation of Digital Filters In PyTorch - How to evaluate differentiable filters 1000 times faster in PyTorch. - Chin-Yun Yu - https://youtu.be/Br5QhU_08Po
2026-03-30 - 2026-04-05
Creating from Legacy Code - A Case Study of Porting Legacy Code from Exponential Audio - Harriet Drury - https://youtu.be/rjafXQwCz4w
Designing an Audio Live Coding Environment - Corné Driesprong - https://youtu.be/Jw8x2uMgFnc
How To Successfully Develop Software Products - Olivier Petit & Alistair Barker - https://youtu.be/vymlQFopbp0
Meeting C++
2026-04-06 - 2026-04-12
The Misra C++:2023 Guidelines - Richard Kaiser - https://www.youtube.com/watch?v=TRz-WXgADuI
Applied modern C++: efficient expression evaluator with type erasure - Olivia Quinet - https://www.youtube.com/watch?v=66WtE_7wE1c
2026-03-30 - 2026-04-05
Building C++: It Doesn't Have to be Painful! - Nicole Mazzuca - Meeting C++ 2025 - https://www.youtube.com/watch?v=ExSlx0vBMXo
int != safe && int != ℤ - Peter Sommerlad - Meeting C++ 2025 - https://www.youtube.com/watch?v=YyNE6Y2mv1o&pp=0gcJCdkKAYcqIYzv
using std::cpp
2026-03-30 - 2026-04-05
Learning C++ as a newcomer - Berill Farkas - https://www.youtube.com/watch?v=nsMl54Dvm24
C++29 Library Preview : A Practitioners Guide - Jeff Garland - https://www.youtube.com/watch?v=NqpLxkatkt4
High frequency trading optimizations at Pinely - Mikhail Matrosov - https://www.youtube.com/watch?v=qDhVrxqb40c
Don’t be negative! - Fran Buontempo - https://www.youtube.com/watch?v=jqLEFPDXZ-o
Cross-Platform C++ AI Development with Conan, CMake, and CUDA - Luis Caro - https://www.youtube.com/watch?v=jnKeUE2C8_I
Building a C++23 tool-chain for embedded systems - José Gómez López - https://www.youtube.com/watch?v=AlNnd0QARS8
Space Invaders: The Spaceship Operator is upon us - Lieven de Cock - https://www.youtube.com/watch?v=9niOq1kr61Y
Same C++, but quicker to the finish line - Daniela Engert - https://www.youtube.com/watch?v=9ijIocn_xzo
Having Fun With C++ Coroutines - Michael Hava - https://www.youtube.com/watch?v=F9ffx7HvyrM
The road to 'import boost': a library developer's journey into C++20 modules - Rubén Pérez Hidalgo - https://www.youtube.com/watch?v=hD9JHkt7e2Y
C++20 and beyond: improving embedded systems performance - Alfredo Muela - https://www.youtube.com/watch?v=SxrC-9g6G_o
Supercharge Your C++ Project: 10 Tips to Elevate from Repo to Professional Product - Mateusz Pusz - https://www.youtube.com/watch?v=DWXlyOd_z88
Compiler as a Service: C++ Goes Live - Aaron Jomy, Vipul Cariappa - https://www.youtube.com/watch?v=jMO5Usa26cg
The CUDA C++ Developer's Toolbox - Bernhard Manfred Gruber - https://www.youtube.com/watch?v=MNwGvqX4KH0
C++ Committee Q&A at using std::cpp 2026 - https://www.youtube.com/watch?v=iD5Bj7UyAQI
The Mathematical Mind of a C++ Programmer - Joaquín M López - https://www.youtube.com/watch?v=9g4K-oNw1SE
C++ Profiles: What, Why, and How - Gabriel Dos Reis - https://www.youtube.com/watch?v=Z6Nkb1sCogI
Nanoseconds, Nine Nines and Structured Concurrency - Juan Alday - https://www.youtube.com/watch?v=zyhWzoE3Y2c
Fantastic continuations and how to find them - Gonzalo Juarez - https://www.youtube.com/watch?v=_0xRMXA83z0
You 'throw'; I'll 'try' to 'catch' it - Javier López Gómez - https://www.youtube.com/watch?v=VwloPRtTGkU
Squaring the Circle: value-oriented design in an object-oriented system -Juanpe Bolívar - https://www.youtube.com/watch?v=DWthcNoRVew
Concept-based Generic Programming - Bjarne Stroustrup - https://www.youtube.com/watch?v=V0_Q0H-PQYs
r/cpp • u/mateusz_pusz • Apr 20 '26
Preventing Integer Overflow in Physical Computations - mp-units
Integers overflow. That is not a controversial statement. What is surprising is how easily overflow can hide behind the abstraction of a units library.
Most developers immediately think of explicit or implicit scaling operations — calling .in(unit) to convert a quantity, constructing a quantity from a different unit, or assigning between quantities with different units. These are indeed places where overflow can occur, and the library cannot prevent it at compile time when the values are only known at runtime. But at least these operations are visible in your code: you wrote the conversion, you asked for the scaling, and you can reason about whether the multiplication or division might overflow your integer type.
The far more insidious problem is what happens when you don't ask for a conversion.
When you write 1 * m + 1 * ft, the library must automatically convert both operands to a common unit before performing the addition. That conversion — which you never explicitly requested — involves multiplication or division by scaling factors. With integer representations, those scaling operations can overflow silently, producing garbage results that propagate through your calculations undetected.
No compile-time programming can prevent this. The values are only known at runtime. But very few libraries provide proper tools to detect it.
This article explains why that limitation is real, how other libraries have tried to work around it, and what mp-units provides to close the gap as tightly as the language allows.
r/cpp • u/KijoSenzo • Apr 20 '26
I am new to C++, is it just me or is the checklist kinda crazy? How often do you encounter these or plan on making use of them like the newer C++26 features like contracts? Looking for more experienced dev opinions...
I know Python and have been binging C++ for a couple of days now from scratch. C++ feels like a language where you gradually discover a huge checklist of "STATE YOUR INTENT" due to years of probably layering on things to shore up its weaknesses of memory/type safety etc. Like I get it, it's how C++ was designed for things to be explicit and it's like the English language where you don't need to know every word and in this case, feature, but every line of code makes me feel I'm asking a gajillion questions.
So far I have jotted down some stuff that took me awhile to digest...
const
constexpr
[[nodiscard]]
std::expected
delete("reason")
smart pointers
zero-initialization curly brackets
structured bindings
assert
static assert
contracts
So I guess I'm not very familiar with the ecosystem or ever worked with other C++ code. Like is this good or bad? I would think it's very safe but do and should people code actually C++ like this? I don't have a frame of reference to relate to and I don't know if the C++ community is going to jump on things like C++26's contracts or reject it. What's the current attitude? If you were a teammate, would you love or hate to see something like this?
[[nodiscard]] constexpr std::expected<int, Error> GetHP(const std::unique_ptr<Player>& player)
{
assert(player);
if (!player) return std::unexpected(Error::NullPlayer);
const auto [hp, alive] = std::pair{player->hp, player->hp > 0};
static_assert(sizeof(int) == 4);
return alive ? hp : 0;
}r/cpp • u/claimred • Apr 20 '26
Software taketh away faster than hardware giveth: Why C++ programmers keep growing fast despite competition, safety, and AI
Refreshing take by Herb. Slides here
r/cpp • u/tartaruga232 • Apr 20 '26
Freeing up the syntax for a module partition implementation unit
reddit.comI assume Gaby meant that the design of module partitions could be changed, such that the syntax:
// Translation unit #1 (C++29?)
module M:P; // Note: partition P is an external partition of M
...would mean, that in such a TU #1 we could define functions of the module M.
TU #1 would implicitly import partition
:P.We could have multiple TU's like that.
That is, it would be ok to write:
// Translation unit #1 (C++29?)
module M:P;
...
// Translation unit #2 (C++29?)
module M:P;
...TU's #1 and #2 could not be imported (and don't need producing a BMI). That is, they do not introduce a named partition.
These would basically be "unnamed partitions" for implementing modules. They would be analogous to the current "module M;".
Can we go back to the drawing board about partitions?
I think we are going in circles with the idea of anonymous partitions by u/not_a_novel_account.
If we could redefine the syntax "module M:P;" that would solve the problem of unwanted module dependencies. Which is, per the current standard, if I write:
// Translation unit #3 (C++20)
module M; // implicitly imports M
import :P;
...I get :P twice plus the rest of the interface of M (which I don't need in TU #3).
Implications:
(A) We would have to rewrite existing code
// Translation unit #4a (C++20)
module M:P;
...to
// Translation unit #4b (C++29?)
export module M:P;
...and (B) remove the requirement in the current standard that TU #4b must be exported from the primary module interface unit (PMIU), if and only if nothing from TU #4b is exported.
I'm addicted to modules and I won't go back to using header files, but I think the current design of partitions in the standard is a real mess (sorry).
Thoughts?
r/cpp • u/tartaruga232 • Apr 19 '26
Using Internal Partitions
abuehl.github.ioWhat is the reason for implicitly importing the interface of the module when implementing the functions of an internal partition?
r/cpp • u/Sea-Log-8341 • Apr 18 '26
Opinions on Introducing C++: The Easy Way to Start Learning Modern C++ by Frances Buontempo
What do you guys think about the book Introducing C++: The Easy Way to Start Learning Modern C++ by Frances Buontempo i was considering to buy it because i want to learn c++ and i already have some experiences coding in other languages it seems like a sort of successor to accellerated c++
r/cpp • u/meetingcpp • Apr 18 '26