Welcome to SwedenCpp
Latest blogs, videos, podcasts and releases in one stream
Saturday, May 16, 2026
Lecture 26. Coroutines, part II: Awaiters and Threads (MIPT, 2025-2026).๐ฅKonstantin Vladimirov
BeCPP Symposium 2026 - Gabriel Dos Reis - Tightening the Screws with C++ Profiles๐ฅBeCPP Users Group
How to join or concat ranges, C++26Modern C++ continuously improves its range library to provide more expressive, flexible, and efficient ways to manipulate collections. Usually, when you wanted to concatenate or flatten ranges, youโd use raw loops or custom algorithms. With C++โs range adaptors, we now have an elegant and efficient way to process collections lazily without unnecessary allocations. In this post, we will explore three powerful range adaptors introduced in different C++ standards: std::ranges::concat_view (C++26) std::ranges::join_view (C++20) std::ranges::join_with_view (C++23) Letโs break down their differences, use cases, and examples. Updated in May 2026: added from_range construction options. std::ranges::concat_view (C++26) The concat_view allows you to concatenate multiple independent ranges into a single sequence. Unlike join_view , it does not require a range of ranges-it simply merges the given ranges sequentially while preserving their structure. In short: Takes multiple independent ranges as arguments. Supports random access if all underlying ranges support it. Allows modification if underlying ranges are writable. Lazy evaluation: No additional memory allocations. See the example: #include #include #include #include int main () { std :: vector std :: string > v1 { "world" , "hi" }; std :: vector std :: string > v2 { "abc" , "xyz" }; std :: string arr []{ "one" , "two" , "three" }; auto v1_rev = v1 | std :: views :: reverse ; auto concat = std :: views :: concat ( v1_rev , v2 , arr ); concat [ 0 ] = "hello" ; // access and write for ( auto & elem : concat ) std :: print ( "{} " , elem ); } See at @Compiler Explorer The output: hello world abc xyz one two three The example below shows how to concatenate three ranges, v1 is reversed and then combined with v2 and arr. Notice that we can also access the value at position 0 and update it. And a bit more complex example: #include #include #include #include #include struct Transaction { std :: string type ; double amount ; }; int main () { std :: vector Transaction > bank_transactions { { "Deposit" , 100.0 }, { "Withdraw" , 50.0 }, { "Deposit" , 200.0 } }; std :: list Transaction > credit_card_transactions { { "Charge" , 75.0 }, { "Payment" , 50.0 } }; auto filtered_bank = bank_transactions | std :: views :: filter ([]( const Transaction & t ) { return t . amount >= 100.0 ; }); auto filtered_credit = credit_card_transactions | std :: views :: filter ([]( const Transaction & t ) { return t . amount > 60.0 ; }); auto all_transactions = std :: views :: concat ( filtered_bank , filtered_credit ); for ( const auto & t : all_transactions ) std :: println ( "{} - {}$" , t . type , t . amount ); } Run @Compiler Explorer std::ranges::join_view (C++20) The join_view is designed for flattening a single range of ranges into a single sequence. It removes the structural boundaries between nested ranges. Works on a single range of ranges (e.g., std::vector > ). Does not support operator[] (no random access). Eliminates boundaries between sub-ranges. Lazy evaluation, avoiding memory copies. A simple example: #include #include #include int main () { std :: vector std :: vector int >> nested {{ 1 , 2 }, { 3 , 4 , 5 }, { 6 , 7 }}; auto joined = std :: views :: join ( nested ); for ( int i : joined ) std :: println ( i ); } Run @Compiler Explorer The output: 1 2 3 4 5 6 7 Of course, we can have different nested rangesโฆ and this can be handy for string processing: #include #include #include #include #include int main () { std :: vector std :: string > words { "Hello" , "World" , "Coding" }; // regular: std :: map char , int > freq ; for ( auto & w : words ) for ( auto & c : w ) freq [ :: tolower ( c )] ++ ; // join: std :: map char , int > freq2 ; for ( auto & c : words | std :: views :: join ) freq2 [ :: tolower ( c )] ++ ; for ( auto & [ key , val ] : freq2 ) std :: println ( "{} -> {}" , key , val ); } Run @Compiler Explorer As you can see, thanks to views_join we can save one nested loop and iterate through a single range of characters. std::ranges::join_with_view (C++23) The join_with_view works like join_view , but it allows inserting a delimiter between flattened sub-ranges. Works on a single range of ranges. Allows specifying a delimiter (single element or a range). Does not support random access. Useful for formatting strings or separating collections. See the example below: #include #include #include #include #include std :: string to_uppercase ( std :: string_view word ) { std :: string result ( word ); for ( char & c : result ) c = std :: toupper ( static_cast unsigned char > ( c )); return result ; } int main () { std :: vector std :: string_view > words { "The" , "C++" , "ranges" , "library" }; auto words_up = words | std :: views :: transform ( to_uppercase ); auto joined = std :: views :: join_with ( words_up , std :: string_view ( " " )); for ( auto c : joined ) std :: cout c ; } See at Compiler Explorer Hereโs the expected output: THE C++ RANGES LIBRARY Creating new containers from the view I think I overlooked one important aspect of our experiments. Itโs good that we can print flattened or concatenated rangesโฆ but what if you want to create another container from that view? A simple example could be as follows: std :: vector int > make_flat ( const std :: vector std :: vector int >> & nested ) { // ?? } auto new_vector = make_flat ( vec_vec ); We have at least four options here: Before C++23, we can push data to the new container in some loop, Or pass begin() and end() iterators, For C++23, we can use ranges::to() , Or, also for C++23, create container directly from a range/view. See the example here: #include #include #include #include #include std :: vector int > make_flat_loop ( const std :: vector std :: vector int >>& nested ) { std :: vector int > out ; for ( int value : nested | std :: views :: join ) out . push_back ( value ); return out ; } std :: vector int > make_flat_iters ( const std :: vector std :: vector int >>& nested ) { auto joined = nested | std :: views :: join ; return { joined . begin (), joined . end () }; } std :: vector int > make_flat_to ( const std :: vector std :: vector int >>& nested ) { return nested | std :: views :: join | std :: ranges :: to std :: vector int >> (); } std :: vector int > make_flat_from_range ( const std :: vector std :: vector int >>& nested ) { auto joined = nested | std :: views :: join ; return std :: vector int > ( std :: from_range , joined ); } int main () { std :: vector std :: vector int >> nested {{ 1 , 2 }, { 3 , 4 , 5 }, { 6 , 7 }}; auto flat1 = make_flat_loop ( nested ); auto flat2 = make_flat_iters ( nested ); auto flat3 = make_flat_to ( nested ); auto flat4 = make_flat_from_range ( nested ); for ( auto && flat : { flat1 , flat2 , flat3 , flat4 }) { for ( int value : flat ) std :: print ( "{} " , value ); std :: println ( "" ); } std :: vector std :: string > words { "C++" , "ranges" , "are" , "powerful" }; auto sentence = std :: string ( std :: from_range , std :: views :: join_with ( words , std :: string_view ( " " )) ); std :: println ( "{}" , sentence ); } See @Compiler Explorer The output: 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 C++ ranges are powerful The C++23 changes came from the following proposal: P1206R7 - Conversions from ranges to containers . Comparing concat_view , join_view , and join_with_view Feature concat_view โ
join_view โ
join_with_view โ
Works on multiple independent ranges? โ
โ โ Flattens nested ranges? โ โ
โ
Supports separators between sub-ranges? โ โ โ
Random access support? โ
(if all inputs support it) โ โ Summary C++โs range adaptors provide efficient ways to manipulate collections without unnecessary copying. Hereโs a quick summary of when to use each view: Use concat_view when merging multiple independent ranges. Use join_view when flattening a range of ranges. Use join_with_view when flattening a range of ranges but needing a separator between elements. References Books: C++23 Best Practices - by Jason Turner Modern C++ Programming Cookbook - by Marius Bancila Programming: Principles and Practice Using C++ - by Bjarne Stroustrup Other: std::ranges::join_view - cppreference.com std::ranges::join_with_view - cppreference.com std::ranges::concat_view - cppreference.com Back to you Do you use ranges? What are your most useful views ald algorithms on ranges? Share your comments below๐C++ StoriesIf this page is useful, please consider your support
Friday, May 15, 2026
Principle Misunderstandings Of C++ Software Design - Kevlin Henney - C++Online 2026๐ฅCppOnline
The case of the CreateยญFileยญMapping that always reported ERROR_ALREADY_EXISTSMaybe because it already exists? The post The case of the CreateยญFileยญMapping that always reported ERROR_ ALREADY_ EXISTS appeared first on The Old New Thing .๐The Old New Thing
Lightning Talk: Bool - Implicitly Dangerous - Jeff Garland - CppCon 2025๐ฅCppCon
When to copy instead of move - threads & containers๐ฅMeetingCpp
Qt Interface Framework with a new Control PanelYou've just implemented a new feature on the project you're working on. Now, it's time to test how does it work when the data is connected. In case you're working on a device which needs to listen to external devices or sensors, this might not be a trivial problem to solve.๐Qt Blog
Cross-Platform Music Software with Rust - Ian Hobson - ADC 2025๐ฅaudiodevconThursday, May 14, 2026
Classes and RAII with โscopeโ - part 2 of N [D Language - Dlang Episode 140]๐ฅMike Shah
Segment Heap support for C++ projects in Visual StudioLearn how Visual Studio enables Segment Heap by default for new C++ projects and how to adopt and verify it in existing builds. The post Segment Heap support for C++ projects in Visual Studio appeared first on C++ Team Blog .๐C++ Team Blog
A constant-space linear-time algorithm for deleting all but the 10 most recent files in a directoryUsing data structures you already knew. The post A constant-space linear-time algorithm for deleting all but the 10 most recent files in a directory appeared first on The Old New Thing .๐The Old New Thing
Lightning Talk: Proof Searching in DepC - Raffaele Rossi - CppCon 2025๐ฅCppCon
Manipulating URLs with Boost URL๐ฅUtah Cpp Programmers
Let's make a programming language!๐ฅPVS-StudioWednesday, May 13, 2026
SIMD-Accelerated Data Processing๐ฅGlobalCpp
MSVC Build Tools Preview updates โ May 2026Try the latest updates to MSVC Build Tools Preview The post MSVC Build Tools Preview updates โ May 2026 appeared first on C++ Team Blog .๐C++ Team Blog
The case of the hang when the user changed keyboard layoutsKeeping things moving. The post The case of the hang when the user changed keyboard layouts appeared first on The Old New Thing .๐The Old New Thing
Lightning Talk: The Classic Missed-Signal! - Gopal Rander - CppCon 2025๐ฅCppCon
Raga as Data: Symbolic Music Representations for Analysis, Visualization & Audio Tools - ADCx India๐ฅaudiodevcon
Make move constructors noexcept or vectors will copy #cplusplus๐ฅMeetingCpp
Happy 8th anniversary C++ InsightsThis year, we celebrate the 8th anniversary of C++ Insights! Thank you all for the wonderful years of support! The current status I've been a bit slower in updating C++ Insights to work with the latest Clang version. As a birthday gift I released the latest C++ Insights version which โฆ๐AndreasFertig.comTuesday, May 12, 2026
MSVC Build Tools version 14.51 (GA) now availableMSVC Build Tools v14.51 GA available in Visual Studio 2026 18.6 The post MSVC Build Tools version 14.51 (GA) now available appeared first on C++ Team Blog .๐C++ Team Blog
Why do Windows client editions on 32-bit x86 systems artificially limit RAM to 4 GB?Compatibility, of course. The post Why do Windows client editions on 32-bit x86 systems artificially limit RAM to 4 GB? appeared first on The Old New Thing .๐The Old New Thing
Lightning Talk: Poor Manโs Autocomplete for Template Arguments - Max Sagebaum - CppCon 2025๐ฅCppCon
From Classroom to Code II: Innovative Qt Apps by Future DevelopersLast year , we shared the story of a new collaboration with the Cologne University of Applied Sciences ( German: TH Kรถln) for a new course titled Engineering Desktop Applications with C++ and Qt (EDA) . The first edition gave students the chance to explore modern C++ and Qt development in a hands-on setting, with teams designing and building their own music player application. Now, the collaboration has successfully entered its second round.๐Qt Blog
Code Review Responses: Add Context When It Counts@media only screen and (max-width: 600px) { .body { overflow-x: auto; } .post-content table, .post-content td { width: auto !important; white-space: nowrap; } } This article was adapted from a Google Tech on the Toilet (TotT) episode. You can download a printer-friendly version of this TotT episode and post it in your office. By Saicharan Nimmala When responding to code review comments, responses like โDone,โ โUpdated,โ or โFixedโ are commonly used to indicate addressing a suggestion. However, sometimes, a little extra context adds a lot of clarity. Next time you resolve a code review comment, ask yourself: "Is how I addressed the comment completely obvious from the code change and comment thread?" If not, supplement your response with a brief note to clarify the โwhyโ or โhow.โ Your reviewers will thank you. When is it helpful to add context to a code review comment response? Here are a few examples: Your code change doesn't fully explain how you addressed the comment . Providing a brief summary helps the reviewer verify the changes without re-examining every line of the delta, and creates a clearer historical record. Reviewer: This approach seems risky. It might not handle all the edge cases properly. Less helpful response: More helpful response: Author: Updated. Good catch. I've added checks for null, empty, and negative inputs, each with a new test case. Thanks! You made a design choice or trade-off that isn't self-evident. Capturing the reasoning behind a choice provides valuable context. Note that non-obvious design choices within the code should ideally be explained in code comments or the commit description as well. Reviewer: Consider using a more performant library for this data transformation. Less helpful response: More helpful response: Author: Iโll go with Y. Done. I considered Library X, but stuck with Library Y because our datasets here are typically small, so the performance difference is negligible, and Library Y has a much simpler API. An offline discussion influenced the solution. Briefly summarizing the outcome or key reasoning from an offline sync ensures that other reviewers, who only see the final code change, can grasp the โwhyโ. Reviewer: This logic seems a bit complex. Consider a simpler way to handle these. Less helpful response: More helpful response: Author: Fixed. As we discussed offline, this complexity is required to maintain backward compatibility with legacy data formats. Iโve added a comment in the code to clarify this. Thank s! There are multiple ways to address the comment. Clearly stating which option you selected and the reasoning behind that choice over other alternatives helps reviewers. Learn more code review practices in Googleโs code review guide: google.github.io/eng-practices/review .๐Google Testing Blog
The full video is on the channel!๐ฅPVS-Studio
May's C Vu Journal has been published.The May 2026 ACCU C Vu journal has been published and should arrive at members' addresses in the next few days. C Vu 38-2 and previous issues of C Vu can be accessed via the Journals menu (ACCU members only).๐ACCU
PVS-Studio 7.42: Testing new analyzers, expanded MISRA C++ 2023 support, and more๐ฅPVS-Studio
Introducing the Documentation MCP Tool for QtHow a Documentation MCP Tool Saves LLM Token Usage Every time an AI agent searches the web for Qt documentation today, it receives full HTML pages loaded with navigation chrome, cookie banners, related-article sidebars, and search-engine snippets that have nothing to do with the answer - burning thousands of LLM tokens before a single line of useful content appears. Qt's new official Model Context Protocol (MCP) tool for Qt documentation solves this directly.๐Qt Blog
cost of enum-to-string: C++26 reflection vs the old wayscost of enum-to-string: C++26 reflection vs the old ways๐vittorio romeo's websiteMonday, May 11, 2026
Classes part 1 of N D Language Dlang Episode 139๐ฅMike Shah
What the heck is Reflection?A casual introduction to C++26's new reflection operators, ^^ and [: :], with a hands-on enum-to-string example.๐Murat Hepeyiler
RPC with RAII and C++ Coroutines - Edward Boggis-Rolfe - C++Online 2026๐ฅCppOnline
Additional notes on controlling which handles are inherited by CreateยญProcessPutting the handles in a private container. The post Additional notes on controlling which handles are inherited by CreateยญProcess appeared first on The Old New Thing .๐The Old New Thing
C++ Weekly - Ep 532 - What Does var{} Do?๐ฅJason Turner
Lightning Talk: Reducing Binary Bloat With Thin Archives - Florent Castelli - CppCon 2025๐ฅCppCon
Introducing the QML Coding Skill for Agentic WorkflowsThe Challenge: Elevating AI-Generated QML to Best-Practise Quality Frontier Large Language Models have become genuinely capable QML authors. Benchmarks show models like Claude, GPT, and Gemini achieving between 75% and 86% accuracy on the QML100 benchmark for single-turn coding tasks - a result that reflects the depth of Qtโs open-source ecosystem and the decades of publicly available QML code that has served as training material. For everyday UI components, a well-prompted AI agent can produce working, readable QML on the first attempt.๐Qt Blog
Sneak Peek at ARA Audio Random Access 3.0 - Embracing Audio Synthesis - Stefan Gretscher - ADC 2025๐ฅaudiodevcon
Why I Built a Sales Tracker for WhatsApp Sellers๐ฅKea Sigma Delta
Why I Built a Sales Tracker for WhatsApp Sellers๐ฅKea Sigma Delta
`std::is_heap` could be faster`is_sorted` doesn't require random access; why should `is_heap`?๐Arthur OโDwyer