r/cpp • • Feb 21 '26

C++26: std::is_within_lifetime

Thumbnail sandordargo.com
95 Upvotes

r/cpp • • Feb 20 '26

BitFields API: Type-Safe Bit Packing for Lock-Free Data Structures

Thumbnail rocksdb.org
21 Upvotes

r/cpp • • Feb 20 '26

Parallel C++ for Scientific Applications: Tasks & Concurrency (2nd Part)

Thumbnail youtube.com
8 Upvotes

In this week’s lecture of Parallel C++ for Scientific Applications, Dr. Hartmut Kaiser continues the discussion on task-based parallelism in C++, specifically focusing on the nuances of asynchronous parallelism. The lecture addresses specific scalability issues inherent in fork-join parallelism and presents unique methods to mitigate them effectively.
A core discussion introduces extensions to standard futures implemented in HPX, a C++ Standard Library for Concurrency and Parallelism. Finally, the lecture demonstrates how these advanced tools can extend standard C++ capabilities, offering practical solutions for building more scalable and responsive high-performance applications.
If you want to keep up with more news from the Stellar group and watch the lectures of Parallel C++ for Scientific Applications and these tutorials a week earlier please follow our page on LinkedIn https://www.linkedin.com/company/ste-ar-group/
Also, you can find our GitHub page below:
https://github.com/STEllAR-GROUP/hpx


r/cpp • • Feb 19 '26

Problems with a weak tryLock operation in C and C++ standards

Thumbnail forums.swift.org
24 Upvotes

r/cpp • • Feb 19 '26

MSVC Build Tools 14.51 Preview released

Thumbnail devblogs.microsoft.com
84 Upvotes

r/cpp • • Feb 19 '26

Learn C++ by Example • Frances Buontempo & Matt Godbolt

Thumbnail youtu.be
28 Upvotes

r/cpp • • Feb 19 '26

Experimental adaptive sort - matches std::sort on random input, 2-8x faster on structured data

34 Upvotes

Hi all,

I’ve been developing an adaptive sorting algorithm, tentatively called JesseSort, which aims to exploit partial order in input data while still being competitive with standard library sorts on random input. I’m looking for feedback on design and potential adoption strategies.

What it does

  • Detects natural runs in the input (ascending, descending, or random) with a tiny lookahead.
  • Maintains two sets of piles for ascending and descending runs, essentially a dual-patience sort.
  • Falls back to tiny 8-value bitonic sort networks on detected random regions.
  • When this random-input block is run too many times, it falls back to std::sort.
  • Currently merges adjacent runs in a naive/bottom-up way.

Current numbers

Median runtime ratios vs std::sort over 100 trials:

Input Type1k Values10k100k1M
Random0.9841.0321.0421.088
Sorted1.0220.6790.5831.448?
Reverse1.6361.0760.9002.101?
Sorted+Noise(5%)1.0481.0411.0791.201
Random+Repeats(50%)1.0371.0321.0311.089
Jitter1.0120.6740.5861.443?
Alternating0.8291.0110.9741.018
Sawtooth1.1210.9600.9781.072
BlockSorted1.0460.9500.9281.153
OrganPipe0.4460.2320.1380.268
Rotated0.5960.5220.3960.716
Signal1.4020.8280.6590.582

Notes:

  • Ratios are JesseSort / std::sort. Values <1 indicate JesseSort is faster. 0.5 means JesseSort takes half the time (2x faster). 2.0 means JesseSort takes twice as much time (2x slower).
  • Large input blow-ups (?) appear to be outliers on my machine, but would be curious to see if others see the same pattern.

Current issues / questions

  1. Handoff threshold: Detecting random input too early loses semi-structured gains; too late slows random input. How should this balance be tuned?
  2. Fallback vs. std::sort: Could JesseSort itself (dual patience games) serve as a better fallback than heap sort in standard introsort implementations?
  3. Merge optimizations: Current merge is bottom-up adjacent. I’ve prototyped a TimSort-style merge that merges smaller runs first. Minor speedups in most cases but I haven't tested it enough.
  4. Memory layout & cache: Some sensitivity to variable placement and data alignment is noticeable. Any advice for robust layout-sensitive optimizations?
  5. Real-world adoption: Even if slightly slower on purely random input (~5%), the structured input gains are often >50%. Would such an algorithm be worth promoting or considered niche? If the hit to random input is too significant, maybe this would find a better home as an alternative like std::structured_sort?

I’m looking for input on:

  • Algorithmic improvements, especially for the random vs structured handoff
  • Practical concerns for integration into standard libraries
  • Benchmark methodology for mixed input distributions
  • Real-world test datasets that might showcase advantages

Code and full details are available here: https://github.com/lewj85/jessesort

Thanks


r/cpp • • Feb 18 '26

Apache Fory C++: Fast Serialization with Shared/Circular Reference Tracking, Polymorphism, Schema Evolutionn and up to 12x Faster Than Protobuf

88 Upvotes

We just released Apache Fory Serialization support for c++:

https://fory.apache.org/blog/fory_cpp_blazing_fast_serialization_framework

Highlights:

  1. Automatic idiomatic cross-language serializaton: no adapter layer, serialize in C++, deserialize in Python.
  2. Polymorphism via smart pointers: Fory detects std::is_polymorphic<T> automatically. Serialize through a shared_ptr<Animal>, get a Dog back.
  3. Circular/shared reference tracking: Shared objects are serialized once and encoded as back-references. Cycles don't overflow the stack.
  4. Schema evolution: Compatible mode matches fields by name/id, not position. Add fields on one side without coordinating deployments.
  5. IDL compiler (optional): foryc ecommerce.fdl --cpp_out ./gen generates idiomatic code for every language from one schema. Generated code can be used as domain objects directly
  6. 6. Row format: O(1) random field access by index, useful for analytics workloads where you only read a few fields per record.

Throughput vs. Protobuf: up to 12x depending on workload.

GitHub: https://github.com/apache/fory

C++ docs: https://fory.apache.org/docs/guide/cpp

I’d really like critical feedback on API ergonomics, and production fit.


r/cpp • • Feb 18 '26

CppCon Practical Reflection - Barry Revzin (CppCon 2026)

Thumbnail youtu.be
72 Upvotes

r/cpp • • Feb 18 '26

LA sprawl c++ meetup Feb 19

7 Upvotes

Hi everyone,

this week the Los Angeles sprawl c++ meetup is meeting in Pasadena!

Tomorrow, Thursday, February 19, at 6:30 pm (please message me for more information!) Feel free to bring a laptop (or not), and join us for an evening of all things c++, with at least an honorable mention of allocator aware types and all that.

We are still growing, and would love to see more people join! There is also a social channel for the meetup, message me if you are interested in that. At this time, as an attempt to accommodate the sprawl as we grow, we alternate meetup locations between Pasadena and Culver City area.


r/cpp • • Feb 17 '26

Back to Basics: How To Improve C++ Code Reviews

Thumbnail youtube.com
42 Upvotes

r/cpp • • Feb 16 '26

Favorite optimizations ??

135 Upvotes

I'd love to hear stories about people's best feats of optimization, or something small you are able to use often!


r/cpp • • Feb 16 '26

New C++ Conference Videos Released This Month - February 2026 (Updated To Include Videos Released 2026-02-09 - 2026-02-15)

32 Upvotes

CppCon

2026-02-09 - 2026-02-15

2026-02-02 - 2026-02-08

2026-01-26 - 2026-02-01

ADC

2026-02-09 - 2026-02-15

2026-02-02 - 2026-02-08

2026-01-26 - 2026-02-01

C++ Under The Sea

2026-02-02 - 2026-02-09

Meeting C++

2026-01-26 - 2026-02-01

ACCU Conference

2026-01-26 - 2026-02-01


r/cpp • • Feb 16 '26

Sourcetrail (Fork) 2025.12.8 released

37 Upvotes

Hi everybody,

Sourcetrail 2025.12.8, a fork of the C++/Java source explorer, has been released with these changes:

  • C++: Add indexing of structured binding declarations
  • C++: Add indexing of auto prvalue casts
  • GUI: Fix error/status view not cleared between indexing
  • C/C++: Replace msvc mulitithreading library switches with corresponding clang switches
  • C/C++: Add Visual Studio 2026 support
  • Database: Enable simple database performance improvement