February 2023

The Iterator Protocol -- Rainer Grimm

A C++ story, as-if ghostwritten by Frederick Forsyth...

The Iterator Protocol

by Rainer Grimm

From the article:

Here is the question I want to answer: What interface must a user-defined type support to be usable in a range-based for-loop. ...

Insights from the second year of running online C++ job fairs

Looking at the second year of Meeting C++ online job fairs

Insights from the second year of running online C++ job fairs

by Jens Weller

From the article:

An overview on the second year of organizing online job fairs for the C++ community.

In 2022 Meeting C++ organized 5 online job fairs for C++. Originally 4 were planned, but in May only one company could attend and two other companies approached Meeting C++ after the event wondering if another fair in June was possible. With better planning this could have been one fair. The next job fair is on March 14th & 15th.

Value Objects -- Rainer Grimm

PortraintRound-1.jpgFrom "Modernes C++":

Value Objects

by Rainer Grimm

From the article:

A value object is a small object whose equality is based on state, but not identity. Typical value objects are money, numbers, or strings. ...

...  For a user-defined type, you have to choose the appropriate equality semantics. ... In C++20, the compiler can auto-generate the equality operator and use it as a fallback for the inequality operator. The auto-generated equality operator applies value equality. To be more precise, the compiler-generated equality operator performs a lexicographical comparison. Lexicographical comparison means that all base classes are compared left to right and all nonstatic members of the class in their declaration order.

I have to add two important points:

Honestly, the example works as expected but does not seem right. ...

2023-02 Mailing Available

The 2023-02 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
N4940 WG21 2022-11 Kona Minutes of Meeting V2 Nina Ranns 2023-01-23 2023-02   All of WG21
N4941 INCITS C++/WG21 Agenda: 6-11 February 2023, Issaquah, WA USA John Spicer 2023-01-21 2023-02   All of WG21
N4942 WG21 2023-01 Admin telecon minutes Nina Ranns 2023-02-02 2023-02   All of WG21
P0290R3 apply() for synchronized_value Anthony Williams 2023-01-17 2023-02 P0290R2 LWG Library
P0290R4 apply() for synchronized_value Anthony Williams 2023-02-16 2023-02 P0290R3 LWG Library
P0447R21 Introduction of std::hive to the standard library Matt Bentley 2023-02-11 2023-02 P0447R20 SG14 Low Latency,LEWG Library Evolution,All of WG21
P0493R4 Atomic maximum/minimum Al Grant 2023-02-15 2023-02 P0493R3 SG1 Concurrency and Parallelism,LWG Library
P0792R13 function_ref: a non-owning reference to a Callable Vittorio Romeo 2023-02-09 2023-02 P0792R12 LWG Library
P0792R14 function_ref: a non-owning reference to a Callable Vittorio Romeo 2023-02-09 2023-02 P0792R13 LWG Library
P0870R5 A proposal for a type trait to detect narrowing conversions Giuseppe D'Angelo 2023-02-15 2023-02 P0870R4 SG6 Numerics,LEWG Library Evolution,LWG Library
P0876R12 fiber_context - fibers without scheduler Oliver Kowalke 2023-02-09 2023-02 P0876R11 LEWG Library Evolution
P1061R4 Structured Bindings can introduce a Pack Barry Revzin 2023-02-15 2023-02 P1061R3 EWG Evolution
P1708R7 Basic Statistics Richard Dosselmann 2023-02-06 2023-02 P1708R6 SG6 Numerics,SG14 Low Latency,LEWG Library Evolution,LWG Library
P1715R1 Loosen restrictions on "_t" typedefs and "_v" values. Jorg Brown 2023-02-06 2023-02 P1715R0 LEWG Library Evolution,CWG Core,LWG Library
P1759R5 Native handles and file streams Elias Kosunen 2023-02-12 2023-02 P1759R4 LWG Library
P1854R4 Making non-encodable string literals ill-formed Corentin Jabot 2023-02-08 2023-02 P1854R3 EWG Evolution
P1928R3 Merge data-parallel types from the Parallelism TS 2 Matthias Kretz 2023-02-03 2023-02 P1928R2 LEWG Library Evolution
P2022R0 Rangified version of lexicographical_compare_three_way Ran Regev 2023-02-06 2023-02   SG9 Ranges,LEWG Library Evolution
P2047R6 An allocator-aware optional type Nina Ranns 2023-02-02 2023-02 P2047R5 LEWG Library Evolution
P2159R1 A Big Decimal Type Bill Seymour 2023-02-06 2023-02 P2159R0 SG6 Numerics
P2300R6 `std::execution` Michał Dominiak 2023-01-19 2023-02 P2300R5 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2308R0 Template parameter initialization S. Davis Herring 2023-02-13 2023-02   CWG Core
P2338R4 Freestanding Library: Character primitives and the C library Ben Craig 2023-02-09 2023-02 P2338R3 LWG Library
P2355R1 Postfix fold expressions S. Davis Herring 2023-02-13 2023-02 P2355R0 EWG Evolution
P2361R6 Unevaluated strings Corentin Jabot 2023-02-12 2023-02 P2361R5 EWG Evolution
P2363R5 Extending associative containers with the remaining heterogeneous overloads Konstantin Boyarinov 2023-02-10 2023-02 P2363R4 LWG Library
P2406R3 Add lazy_counted_iterator Yehezkel Bernat 2023-02-06 2023-02 P2406R2 SG9 Ranges,LEWG Library Evolution
P2406R4 Add lazy_counted_iterator Yehezkel Bernat 2023-02-07 2023-02 P2406R3 SG9 Ranges,LEWG Library Evolution
P2406R5 Add lazy_counted_iterator Yehezkel Bernat 2023-02-08 2023-02 P2406R4 SG9 Ranges,LEWG Library Evolution
P2495R2 Interfacing stringstreams with string_view Michael Hava 2023-02-14 2023-02 P2495R1 LWG Library
P2497R0 Testing for success or failure of charconv functions Jonathan Wakely 2023-01-25 2023-02   LEWG Library Evolution
P2521R3 Contract support -- Record of SG21 consensus Andrzej Krzemieński 2023-02-10 2023-02 P2521R2 SG21 Contracts
P2527R2 std::variant_alternative_index and std::tuple_element_index Alex Christensen 2023-01-27 2023-02 P2527R1 LWG Library
P2545R3 Why RCU Should be in C++26 Paul E. McKenney 2023-02-15 2023-02 P2545R2 LWG Library
P2558R2 Add @, $, and ` to the basic character set Steve Downey 2023-02-08 2023-02 P2558R1 SG16 Unicode,SG22 Compatability
P2572R1 std::format() fill character allowances Tom Honermann 2023-02-08 2023-02 P2572R0 LWG Library
P2588R3 Relax std::barrier phase completion step guarantees Gonzalo Brito 2023-02-07 2023-02 P2588R2 LWG Library
P2591R3 Concatenation of strings and string views Giuseppe D'Angelo 2023-01-30 2023-02 P2591R2 LEWG Library Evolution
P2592R3 Hashing support for std::chrono value classes Giuseppe D'Angelo 2023-02-10 2023-02 P2592R2 LEWG Library Evolution,LWG Library
P2593R1 Allowing static_assert(false) Barry Revzin 2023-01-19 2023-02 P2593R0 EWG Evolution
P2594R1 Slides: Allow programmer to control coroutine elision (P2477R3 Presentation)) Chuanqi Xu 2023-02-07 2023-02 P2594R0 EWG Evolution
P2609R2 Relaxing Ranges Just A Smidge John Eivind Helset 2023-01-22 2023-02 P2609R1 LWG Library
P2609R3 Relaxing Ranges Just A Smidge John Eivind Helset 2023-02-10 2023-02 P2609R2 LWG Library
P2616R4 Making std::atomic notification/wait operations usable in more situations Lewis Baker 2023-02-15 2023-02 P2616R3 LEWG Library Evolution
P2621R2 UB? In my Lexer? Corentin Jabot 2023-02-08 2023-02 P2621R1 SG22 Compatability,EWG Evolution
P2641R2 Checking if a union alternative is active Barry Revzin 2023-02-07 2023-02 P2641R1 LEWG Library Evolution
P2652R2 Disallow user specialization of allocator_traits Pablo Halpern 2023-02-08 2023-02 P2652R1 LWG Library
P2655R2 common_reference_t of reference_wrapper Should Be a Reference Type Hui Xie 2023-02-06 2023-02 P2655R1 SG9 Ranges,LEWG Library Evolution
P2655R3 common_reference_t of reference_wrapper Should Be a Reference Type Hui Xie 2023-02-07 2023-02 P2655R2 SG9 Ranges,LEWG Library Evolution
P2656R2 C++ Ecosystem International Standard René Ferdinand Rivera Morell 2023-02-14 2023-02 P2656R1 SG15 Tooling
P2663R1 Proposal to support interleaved complex values in std::simd Daniel Towner 2023-01-25 2023-02 P2663R0 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2664R1 Proposal to extend std::simd with permutation API Daniel Towner 2023-01-25 2023-02 P2664R0 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2670R1 Non-transient constexpr allocation Barry Revzin 2023-02-03 2023-02 P2670R0 EWG Evolution
P2679R2 Fixing std::start_lifetime_as and std::start_lifetime_as_array Timur Doumler 2023-02-14 2023-02 P2679R1 CWG Core,LWG Library
P2681R1 More Basic Statistics Richard Dosselmann 2023-02-06 2023-02 P2681R0 SG6 Numerics,SG19 Machine Learning
P2693R1 Formatting thread::id and stacktrace Corentin Jabot 2023-02-09 2023-02 P2693R0 LEWG Library Evolution
P2695R1 A proposed plan for contracts in C++ Timur Doumler 2023-02-09 2023-02 P2695R0 SG21 Contracts,EWG Evolution
P2724R1 constant dangling Jarrad J. Waterloo 2023-02-13 2023-02 P2724R0 SG22 Compatability,SG23 Safety and Security
P2727R1 std::iterator_interface Zach Laine 2023-02-01 2023-02 P2727R0 LEWG Library Evolution
P2730R1 variable scope Jarrad J. Waterloo 2023-02-14 2023-02 P2730R0 SG22 Compatability,SG23 Safety and Security
P2733R1 Fix handling of empty specifiers in std::format Victor Zverovich 2023-02-06 2023-02 P2733R0 LEWG Library Evolution
P2733R2 Fix handling of empty specifiers in std::format Victor Zverovich 2023-02-09 2023-02 P2733R1 LEWG Library Evolution
P2733R3 Fix handling of empty specifiers in std::format Victor Zverovich 2023-02-10 2023-02 P2733R2 LEWG Library Evolution,LWG Library
P2736R2 Referencing the Unicode Standard Corentin Jabot 2023-02-09 2023-02 P2736R1 CWG Core
P2738R1 constexpr cast from void*: towards constexpr type-erasure Corentin Jabot 2023-02-13 2023-02 P2738R0 EWG Evolution
P2740R1 Simpler implicit dangling resolution Jarrad J. Waterloo 2023-01-15 2023-02 P2740R0 EWG Evolution
P2740R2 Simpler implicit dangling resolution Jarrad J. Waterloo 2023-02-13 2023-02 P2740R1 SG23 Safety and Security
P2741R1 user-generated static_assert messages Corentin Jabot 2023-02-12 2023-02 P2741R0 EWG Evolution
P2742R1 indirect dangling identification Jarrad J. Waterloo 2023-01-15 2023-02 P2742R0 EWG Evolution
P2742R2 indirect dangling identification Jarrad J. Waterloo 2023-02-13 2023-02 P2742R1 SG23 Safety and Security
P2749R0 Down with "character" Corentin Jabot 2023-02-12 2023-02   SG16 Unicode,CWG Core
P2750R1 C Dangling Reduction Jarrad J. Waterloo 2023-01-15 2023-02 P2750R0 EWG Evolution
P2750R2 C Dangling Reduction Jarrad J. Waterloo 2023-02-13 2023-02 P2750R1 SG22 Compatability,SG23 Safety and Security
P2751R1 Evaluation of Checked Contracts Joshua Berne 2023-02-14 2023-02 P2751R0 SG21 Contracts
P2754R0 Deconstructing Avoiding Uninitialized Reads of Auto Variables Jake Fevold 2023-01-24 2023-02   SG23 Safety and Security,EWG Evolution
P2759R1 DG Opinion on Safety for ISO C++ Michael Wong 2023-01-22 2023-02 P2759R0 SG23 Safety and Security,All of WG21
P2763R1 `layout_stride` static extents default constructor fix Christian Trott 2023-02-07 2023-02 P2763R0 All of WG21
P2770R0 Stashing stashing iterators for proper flattening Tim Song 2023-01-31 2023-02   LWG Library
P2771R0 Towards memory safety in C++ Thomas Neumann 2023-01-17 2023-02   EWGI SG17: EWG Incubator
P2772R0 std::integral_constant literals do not suffice - constexpr_t? Matthias Kretz 2023-01-17 2023-02   LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P2773R0 Considerations for Unicode algorithms Corentin Jabot 2023-02-16 2023-02   SG16 Unicode
P2779R0 Make basic_string_view's range construction conditionally explicit Giuseppe D'Angelo 2023-02-02 2023-02   SG9 Ranges,SG16 Unicode,LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P2782R0 A proposal for a type trait to detect if value initialization can be achieved by zero-filling Giuseppe D'Angelo 2023-02-13 2023-02   SG14 Low Latency,EWG Evolution,LEWG Library Evolution
P2784R0 Not halting the program after detected contract violation Andrzej Krzemieński 2023-02-09 2023-02   SG21 Contracts
P2786R0 Trivial relocatability options Mungo Gill 2023-02-10 2023-02   EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P2787R0 pmr::generator - Promise Types are not Values Steve Downey 2023-02-06 2023-02   LEWG Library Evolution,LWG Library
P2787R1 pmr::generator - Promise Types are not Values Steve Downey 2023-02-08 2023-02 P2787R0 LWG Library
P2788R0 Linkage for modular constants S. Davis Herring 2023-02-11 2023-02   EWG Evolution,CWG Core
P2789R0 C++ Standard Library Ready Issues to be moved in Issaquah, Feb. 2023 Jonathan Wakely 2023-02-13 2023-02   All of WG21
P2790R0 C++ Standard Library Immediate Issues to be moved in Issaquah, Feb. 2023 Jonathan Wakely 2023-02-13 2023-02   All of WG21
P2791R0 mandate concepts for new features Ran Regev 2023-02-07 2023-02   LEWG Library Evolution,LWG Library,Direction Group
P2796R0 Core Language Working Group "ready" Issues for the February, 2023 meeting Jens Maurer 2023-02-11 2023-02   CWG Core
P2797R0 Proposed resolution for CWG2692 Static and explicit object member functions with the same par Gašper Ažman 2023-02-10 2023-02   EWG Evolution,CWG Core
P2798R0 Fix layout mappings all static extent default constructor Christian Trott 2023-02-09 2023-02   LWG Library
P2799R0 Closed ranges may be a problem; breaking counted_iterator is not the solution Tim Song 2023-02-13 2023-02   SG9 Ranges,LEWG Library Evolution
P2802R0 Presentation of P1385R7 to LEWG at Issaquah 2023 Guy Davidson 2023-02-09 2023-02   LEWG Library Evolution
P2803R0 std::simd Intro slides Matthias Kretz 2023-02-09 2023-02   LEWG Library Evolution
P2805R0 fiber_context: fibers without scheduler - LEWG slides Nat Goodspeed 2023-02-09 2023-02   LEWG Library Evolution
P2806R0 do expressions Barry Revzin 2023-02-14 2023-02   EWG Evolution
P2807R0 Issaquah Slides for Intel response to std::simd Daniel Towner 2023-02-10 2023-02   SG1 Concurrency and Parallelism,LEWG Library Evolution
P2808R0 Internal linkage in the global module S. Davis Herring 2023-02-13 2023-02   EWG Evolution,CWG Core
P2810R0 is_debugger_present is_replaceable René Ferdinand Rivera Morell 2023-02-14 2023-02   SG15 Tooling
P2812R0 P1673R11 LEWG presentation Mark Hoemmen 2023-02-13 2023-02   LEWG Library Evolution
P2815R0 Slides for presentation on P2188R1 Anthony Williams 2023-02-16 2023-02   EWG Evolution
P2816R0 Safety Profiles: Type-and-resource Safe programming in ISO Standard C++ Bjarne Stroustrup 2023-02-16 2023-02   All of WG21

std::initializer_list in C++, Caveats and Improvements -- Bartłomiej Filipek

bw_photo_small.pngDelving into the "how it works" and "why use it" of std::initializer_list...

std::initializer_list in C++, Caveats and Improvements

by Bartłomiej Filipek

From the article:

In this article, you’ll learn why std::initializer_list has a bad reputation in C++...

... We can make the following conclusion:

std::initializer_list is a “view” type; it references some implementation-dependent and a local array of const values. Use it mainly for passing into functions when you need a variable number of arguments of the same type. If you try to return such lists and pass them around, then you risk lifetime issues. Use with care.

Let’s take on another limitation: ...

C++ Brace Pair Colorization and More in Visual Studio -- Mryam Girmay

Mryam-G1-96x96.jpgVisual Studio has a host of new productivity features, which you can read about in this article.

C++ Brace Pair Colorization and More in Visual Studio

by Mryam Girmay

From the article:

You can now visually distinguish each set of opening and closing braces for your C++ code making it easier to see your code’s scope or find any missing braces. There will be different colors for curly braces, and the paired braces {} will have the same color, which will make it easy to visualize where the braces open and close especially when you have intensely nested codes. The feature is available for C++ today and will be coming to additional languages in subsequent releases.

Debug Linux Console apps in Visual Studio’s Integrated Terminal -- Sinem Akinci

Visual Studio now comes with support for debugging interactive console applications directly from the IDE.

Debug Linux Console apps in Visual Studio’s Integrated Terminal

By Sinem Akinci

From the article:

Now, using the Linux Console embedded in the Integrated Terminal, Visual Studio supports a fully functional terminal-like experience when debugging Linux applications. This new Linux Console emulates an xterm and can support application screen manipulation; for example, writing screen formatting control characters to stdout or using the ncurses library. Additionally, there is support for vt sequences and keyboard shortcuts such as Ctrl+C application interruption.

Abseil Strings Library -- Yury Fedorov

Let's talk a bit about one of the most used Abseil parts:

Abseil Strings Library

by Yury Fedorov

From the article:

Abseil is an open source solution from Google that implements many basic and very helpful construction blocks for C++. Thanks to Abseil you may create a great isolation layer from your version of C++ compiler. In this article I will focus on few common functions from one of the most used Abseil libraries: absl::strings.

VS Code C++ Extension January Update: Create Definitions and Declarations -- Alexandra Kemper

You can now create declarations from definitions and vice versa in Visual Studio Code.

VS Code C++ Extension January Update: Create Definitions and Declarations

by Alexandra Kemper

From the article:

Starting with the 1.13.6 version of the C++ Extension in VS Code, we are happy to share a much requested feature: Auto creation of definitions or declarations for functions! You can now quickly create a declaration in a header file for a function you only have a definition for, or vice versa. These generated definitions and declarations already include all function arguments, so no need for constant copying, pasting, and double checking.