Skip to content

steve-downey/wg21-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ 23 Features

P0009 mdspan: A Non-Owning Multidimensional Array Reference (H. Carter Edwards, Bryce Adelstein

This paper proposes adding to the C++ Standard Library a multidimensional array view, mdspan, along with classes, class templates, and constants for describing and creating multidimensional array views. It also proposes adding the submdspan function that “slices” (returns an mdspan that views a subset of) an existing mdspan.

The mdspan class template can represent arbitrary mixes of compile-time or run-time extents. Its element type can be any complete object type that is neither an abstract class type nor an array type. It has two customization opportunities for users: the layout mapping and the accessor. The layout mapping specifies the formula, and properties of the formula, for mapping a multidimensional index to an element of the array. The accessor governs how elements are read and written.

tags: LWG, C++23, linear-algebra, tentatively-ready-for-plenary, IS, size - large, plenary-approved, mdspan

P0288 any_invocable (Ryan McDougall, Matt Calabrese)

This paper proposes a conservative, move-only equivalent of std::function.

tags: LWG, C++23, IS, large, plenary-approved

P0323 std::expected (Vicente Botet, JF Bastien, Jonathan Wakely)

Class template expected<T, E> is a vocabulary type which contains an expected value of type T, or an error E. The class skews towards behaving like a T, because its intended use is when the expected type is contained. When something unexpected occurs, more typing is required. When all is good, code mostly looks as if a T were being handled.

tags: LWG, C++23, IS, B3 - addition, size - large, plenary-approved

P0330 Literal Suffixes for ptrdiff_t and size_t (JeanHeyd Meneide, Rein Halbersma)

This paper proposes core language suffixes for size_t and its associated signed type.

Before
std::vector<int> v{0, 1, 2, 3};
for (auto i = 0u, s = v.size(); i < s; ++i) {
	/* use both i and v[i] */
}
⚠️ - Compiles on 32-bit, truncates (maybe with warnings) on 64-bit
std::vector<int> v{0, 1, 2, 3};
for (auto i = 0, s = v.size(); i < s; ++i) {
	/* use both i and v[i] */
}
❌ - Compilation error
After
std::vector<int> v{0, 1, 2, 3};
for (auto i = 0uz, s = v.size(); i < s; ++i) {
	/* use both i and v[i] */
}

LWG, C++23, tiny, plenary-approved

tags: C++23, plenary-approved

P0401R1 Providing size feedback in the Allocator interface (Chris Kennelly, Jonathan Wakely)

LWG, C++23, size - small, plenary-approved

P0401 Providing size feedback in the Allocator interface (Chris Kennelly, Jonathan Wakely)

Utilize size feedback from Allocator to reduce spurious reallocations

tags: LWG, C++23, small, plenary-approved

P0429 A Standard flatmap (Zach Laine)…

This paper outlines what a (mostly) API-compatible, non-node-based map might look like. Rather than presenting a final design, this paper is intended as a starting point for discussion and as a basis for future work. Specifically, there is no mention of multimap, set, or multiset.

The final paper has wording for a map based on contiguous storage of keys and data.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P0448 A strstream replacement using span<charT> as buffer (Peter Sommerlad)

This paper proposes a class template basic_spanbuf and the corresponding stream class templates to enable the use of streams on externally provided memory buffers. No ownership or re-allocation support is given. For those features we have string-based streams

Example
char        input[] = "10 20 30";
ispanstream is{span<char>{input}};
int         i;
is >> i;
ASSERT_EQUAL(10, i);
is >> i;
ASSERT_EQUAL(20, i);
is >> i;
ASSERT_EQUAL(30, i);
is >> i;
ASSERT(!is);
tags: LWG, C++23, size - large, plenary-approved

P0533 constexpr for <cmath> and <cstdlib> (Edward J. Rosten, Oliver J. Rosten)

We propose simple criteria for selecting functions in <cmath> which should be declared constexpr. There is a small degree of overlap with <cstdlib>. The aim is to transparently select a sufficiently large portion of <cmath> in order to be useful but without placing too much burden on compiler vendors.

Example

constexpr int foo(float x) {
int a{}; int* pa{&a};
std::frexpr(x, pa);
return a;
}

constexpr int i{foo(0.5f)}.
tags: CWG, LWG, C++23, IS, B3 - addition, size - medium, plenary-approved, constexpr

P0627 Function to mark unreachable code (Melissa Mears)

This proposal introduces a new standard library function, std::unreachable, for marking locations in code execution as being known by the programmer to be unreachable.

Example
[[noreturn]] void kill_self() {
    kill(getpid(), SIGKILL);
    std::unreachable();
}
tags: LWG, C++23, IS, B3 - addition, size - small, plenary-approved, expedited-library-evolution-electronic-poll

P0798 Monadic operations for std::optional (Sy Brand)

std::optional will be a very important vocabulary type in C++17 and up. Some uses of it can be very verbose and would benefit from operations which allow functional composition. I propose adding map, and_then, and or_else member functions to std::optional to support this monadic style of programming.

Example

std::optional<image> get_cute_cat(const image& img) {
    return crop_to_cat(img)
        .and_then(add_bow_tie)
        .and_then(make_eyes_sparkle)
        .map(make_smaller)
        .map(add_rainbow);
}

Quote

Here is a list of programming languages which have a optional-like type without a monadic interface or syntactic sugar:

  • C++
  • I couldn’t find any others

Monadic interface

map
map applies a function to the value stored in the optional and returns the result wrapped in an optional. If there is no stored value, then it returns an empty optional.
and_then
and_then is like map, but it is used on functions which may not return a value.
or_else
or_else returns the optional if it has a value, otherwise it calls a given function. This allows you do things like logging or throwing exceptions in monadic contexts:
tags: LWG, SG14, C++23, IS, size - small, plenary-approved

P0847 Deducing this (Gašper Ažman, Sy Brand, Ben Deane, Barry Revzin)

We propose a new mechanism for specifying or deducing the value category of an instance of a class — in other words, a way to tell from within a member function whether the object it’s invoked on is an lvalue or an rvalue; whether it is const or volatile; and the object’s type.

A non-static member function can be declared to take as its first parameter an explicit object parameter, denoted with the prefixed keyword this. Once we elevate the object parameter to a proper function parameter, it can be deduced following normal function template deduction rules:

Example

struct X {
    void foo(this X const& self, int i);

    template <typename Self>
    void bar(this Self&& self);
};

struct D : X {};

void ex(X& x, D const& d) {
    x.foo(42);     // 'self' is bound to 'x', 'i' is 42
    x.bar();       // deduces Self as X&, calls X::bar<X&>
    move(x).bar(); // deduces Self as X, calls X::bar<X>

    d.foo(17); // 'self' is bound to 'd'
    d.bar();   // deduces Self as D const&, calls X::bar<D const&>
}

Example

vector captured = {1, 2, 3, 4};
[captured](this auto&& self) -> decltype(auto) {
  return forward_like<decltype(self)>(captured);
}

[captured]<class Self>(this Self&& self) -> decltype(auto) {
  return forward_like<Self>(captured);
}
tags: CWG, C++23, plenary-approved

P0943 Support C atomics in C++ (Hans-J. Boehm)

We propose to define what it means to include the C <stdatomic.h> header from C++ code. The goal is to enable “shared” headers that use atomics, and can be included from either C or C++ code.

tags: C++23, IS, B2 - improvement, size - small, plenary-approved

P1048 A proposal for a type trait to detect scoped enumerations (Juan Alday)

This paper proposes is_scoped_enum, a new trait for the C++ Standard Library, to detect whether a type is a scoped enumeration.

tags: C++23, IS, B3 - addition, size - small, plenary-approved

P1072 basic_string::resize_default_init (Chris Kennelly, Mark Zeren)

Allow access to default initialized elements of basic_string.

Example
std::string GeneratePattern(const std::string& pattern, size_t count) {
    std::string ret;

    const auto step = pattern.size();
    // GOOD: No initialization
    ret.resize_default_init(step * count);
    for (size_t i = 0; i < count; i++) {
        // GOOD: No bookkeeping
        memcpy(ret.data() + i * step, pattern.data(), step);
    }

    return ret;
}
tags: LWG, C++23, IS, plenary-approved

P1102 Down with ()! (Alex Christensen, JF Bastien)

A proposal for removing unnecessary ()’s from C++ lambdas.

tags: C++23, IS, plenary-approved

P1132 out_ptr - a scalable output pointer abstraction (JeanHeyd Meneide, Todor Buyukliev, Isabella Muerte)

out_ptr is an abstraction to bring both C APIs and smart pointers back into the promised land by creating a temporary pointer-to-pointer that updates the smart pointer when it destructs.

Example
error_num c_api_create_handle(int seed_value, int** p_handle);
void      c_api_delete_handle(int* handle);

struct resource_deleter {
    void operator()(int* handle) { c_api_delete_handle(handle); }
};

std::unique_ptr<int, resource_deleter> resource(nullptr);
error_num err = c_api_create_handle(24, std::out_ptr(resource));
if (err == C_API_ERROR_CONDITION) {
    // handle errors
}
// resource.get() the out-value from the C API function
tags: LWG, C++23, IS, plenary-approved

P1147 Printing volatile Pointers (Bryce Adelstein Lelbach)

Printing pointers to volatile types with standard library output streams has unexpected results. Consider the following code:

Example

#include <iostream>

int main() {
    int*          p0 = reinterpret_cast<int*>(0xdeadbeef);
    volatile int* p1 = reinterpret_cast<volatile int*>(0xdeadbeef);

    std::cout << p0 << std::endl;
    std::cout << p1 << std::endl;
}

This produces the following output:

0xdeadbeef
  

1

tags: LWG, C++23, IS, plenary-approved

P1169 static operator() (Barry Revzin, Casey Carter)

The proposal is to just allow the ability to make the call operator a static member function, instead of requiring it to be a non-static member function. We have many years of experience with member-less function objects being useful.

tags: CWG, LWG, straw-poll, C++23, tentatively-ready-for-plenary, IS, B3 - addition, size - medium, plenary-approved, expedited-library-…

P1206 ranges::to: A function to convert any range to a container (Corentin Jabot, Eric Niebler, Casey Carter)

We propose a function to copy or materialize any range (containers and views alike) to a container.

Before/After Table

Before:

std::map<int, widget>                           map = get_widgets_map();
std::vector<typename decltype(map)::value_type> vec;
vec.reserve(map.size());
ranges::move(map, std::back_inserter(vec));

After:

auto vec = get_widgets_map() | ranges::to<vector>
tags: LWG, ranges, C++23, IS, plenary-approved

P1222 A Standard flatset (Zach Laine)

This paper outlines what a (mostly) API-compatible, non-node-based set might look like.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P1223 find_backward (Zach Laine)

Consider how finding the last element that is equal to ‘x‘ in a range is typically done (for all the examples below, we assume a valid range of elements [first, last), and an iterator it within that range):

Consider this instead: auto it = std::find_last(first, it, x); // Use it here… That’s better! It’s a lot less verbose.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, expedited-library-evolution-electronic-poll

P1264 Revising the wording of stream input operations (Louis Dionne)

The wording in [istream], [istream.formatted] and [istream.unformatted] is very difficult to follow when it comes to exceptions. Some requirements are specified more than once in different locations, which makes it ambiguous how requirements should interact with each other.

tags: LWG, C++23, IS, lwg-pending, B2 - improvement, size - medium, plenary-approved, lwg-wording-only

P1272 Byteswapping for fun&&nuf (Isabella Muerte)

namespace std {
    template <class IntegerType>
    constexpr IntegerType byteswap (IntegerType value) noexcept;
}
// Where std::is_integral_v<IntegerType> is true.
tags: CWG, LWG, C++23, plenary-approved

P1328 Making std::type_info::operator== constexpr (Peter Dimov)

This paper proposes std::type_info::operator== and operator!= be made constexpr, enabling practical, rather than theoretical, use of typeid in constant expressions.

tags: LWG, C++23, IS, B3 - addition, size - tiny, plenary-approved

P1401 Narrowing contextual conversions to bool (Andrzej Krzemienski)

This paper proposes to allow narrowing conversions in contextually converted constant expressions of type `bool`.

TodayIf accepted
if constexpr(bool(flags & Flags::Exec))if constexpr(flags & Flags::Exec)
if constexpr(flags & Flags::Exec != 0)if constexpr(flags & Flags::Exec)
static_assert(N % 4 != 0);static_assert(N % 4);
static_assert(bool(N));static_assert(N);
tags: CWG, C++23, plenary-approved

P1413 A safer interface for std::aligned_storage (CJ Johnson)

[] the standard library should provided two more symbols in the form of typedefs that take in a single template type parameter and, on behalf of the user, deduce the size and alignment of that type, passing in the values to std::aligned_storage. The symbols should be std::aligned_storage_for and std::aligned_storage_for_t. Like std::aligned_storage and std::aligned_storage_t, they should be available in the <type_traits> header of the standard library.

tags: LWG, C++23, plenary-approved

P1425 Iterators pair constructors for stack and queue (Corentin Jabot)

This paper proposes to add iterators-pair constructors to std::stack and std::queue

Example

BeforeAfter
std::vector<int> v(42);std::vector<int> v(42);
std::stack<int> s({v.begin(), v.end()});std::stack s(v.begin(), v.end());
std::queue<int> q({v.begin(), v.end()});std::queue q(v.begin(), v.end());
tags: LWG, C++23, B2 - improvement, size - small, plenary-approved

P1467 Extended floating-point types (Michał Dominiak, David Olsen)

This paper introduces the notion of extended floating-point types, modeled after extended integer types. To accomodate them, this paper also attempts to rewrite the current rules for floating-point types, to enable well-defined interactions between all the floating-point types. The end goal of this paper, together with [P1468], is to have a language to enable <cstdint>-like aliases for implementation specific floating point types, that can model more binary layouts than just a single fundamental type (the previously proposed short float) can provide for

tags: CWG, LWG, straw-poll, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved

P1518 Stop overconstraining allocators in container deduction guides (Arthur O’Dwyer, Mike Spertus)

Discussion of flatmap’s deduction guides revealed that the deduction guides for sequence containers and container adaptors are needlessly overconstrained, making use cases such as pmr containers unnecessarily difficult.

tags: LWG, C++23, IS, size - small, plenary-approved

P1642 Freestanding Library: Easy [utilities] (Ben Craig)

This paper proposes adding many of the facilities in the [utilities], [ranges], and [iterators] clause to the freestanding subset of C++. The paper will be adding only complete entities, and will not tackle partial classes. For example, classes like pair and tuple are being added, but trickier classes like optional, variant, and bitset will come in another paper.

The <memory> header depends on facilities in <ranges> and <iterator>, so those headers (and clauses) are addressed as well.

tags: CWG, LWG, SG14, C++23, tentatively-ready-for-plenary, freestanding, IS, B2 - improvement, size - medium, plenary-approved

P1659 starts_with and ends_with (Christopher Di Bella)

This proposal seeks to add std::ranges::starts_with and std::ranges::ends_with, which would work on arbitrary ranges, and also answer questions such as “are the starting elements of `r1` less than the elements of `r2`?” and “are the final elements of `r1` greater than the elements of `r2`?”

Before/After Table

Before:

auto some_ints      = view::iota(0, 50);
auto some_more_ints = view::iota(0, 30);
if (ranges::mismatch(some_ints, some_more_ints).in2 == end(some_more_ints)) {
    // do something
}

After:

auto some_ints      = view::iota(0, 50);
auto some_more_ints = view::iota(0, 30);
if (ranges::starts_with(some_ints, some_more_ints)) {
    // do something
}
tags: LWG, C++23, IS, size - small, plenary-approved

P1675 rethrow_exception must be allowed to copy (Billy O’Neal)

The current_exception wording was carefully written to allow both ABIs like MSVC++’s where the exception objects are generally constructed on the stack, and ABIs like the Itanium C++ ABI where the exception objects are generally constructed on the heap (and possibly reference counted). Implementations are given the freedom they need to (possibly) copy the exception object into the memory held by the exception_ptr, and similar. See http://eel.is/c++draft/propagation#8.

Unfortunately, such care was not taken for rethrow_exception.

tags: CWG, LWG, C++23, B2 - improvement, size - small, plenary-approved

P1679 String Contains function (Wim Leflere)

This paper proposes to add member function contains to class templates basic_string and basic_string_view. This function checks, whether or not a string contains a given substring.

tags: C++23, IS, size - small, plenary-approved

P1682 std::to_underlying (JeanHeyd Meneide)

A proposal to add a short utility function to handle going from an enumeration to its underlying integral value for safety and ease of use.

tags: C++23, IS, size - small, plenary-approved

P1774 Portable optimisation hints (Timur Doumler)

We propose a standard facility providing the semantics of existing compiler intrinsics such as __builtin_assume (Clang) and __assume (MSVC, Intel) that tell the compiler to assume a given C++ expression without evaluating it, and to optimise based on this assumption. This is very useful for high-performance and low-latency applications in order to generate both faster and smaller code.

tags: CWG, straw-poll, C++23, plenary-approved

P1787 Declarations and where to find them (S. Davis Herring)

The current descriptions of scope and name lookup are confusing, incomplete, and at times incorrect.

tags: modules, C++23, IS, plenary-approved

P1847 Make declaration order layout mandated (Pal Balog)

The current rules allow implementations freedom to reorder members in the layout if they have different access control. To our knowledge no implementation actually used that freedom. We propose to fix this established industry practice in the standard as mandatory.

tags: CWG, C++23, plenary-approved

P1899 stride_view (Christopher Di Bella)

The ability to use algorithms over an evenly-spaced subset of a range has been missed in the STL for a quarter of a century. Given that there’s no way to compose a strided range adaptor in C++20, this should be adopted for C++23.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, plenary-approved, expedited-library-evolution-electronic-poll

P1938 if consteval (Barry Revzin, Daveed Vandevoorde, Richard Smith)

We propose a new form of if statement which is spelled:

if consteval { }

Example

consteval int f(int i) { return i; }

constexpr int g(int i) {
    if consteval {
        return f(i) + 1; // ok: immediate function context
    } else {
        return 42;
    }
}

consteval int h(int i) {
    return f(i) + 1; // ok: immediate function context
}
tags: CWG, LWG, C++23, plenary-approved

P1949 C++ Identifier Syntax using Unicode Standard Annex 31 (Steve Downey)

Adopt Unicode Annex 31 as part of C++ 23.

  • That C++ identifiers match the pattern (XID_Start + _ ) + XID_Continue*.
  • That portable source is required to be normalized as NFC.
  • That using unassigned code points be ill-formed.

In addition adopt this proposal as a Defect Report against C++ 20 and earlier.

Examples

bool 👷 = true; //  Construction Worker
bool 👷‍♀ = false; // Woman Construction Worker ({Construction Worker}{ZWJ}{Female Sign})
int= 0; //not valid
int 🕐 = 0;

int= 0; //not valid
int 💀 = 0;

int= 0; //not valid
int 👊 = 0;

int= 0; //not valid
int 🚀 = 0;

int= 0; //not valid
int 😀 = 0;

All Invalid After p1949

tags: CWG, C++23, plenary-approved

P1951 Default Arguments for pair’s Forwarding Constructor (Logan R. Smith)

This paper proposes defaulting the template arguments U1 and U2 in pair’s forwarding constructor to T1 and T2 respectively, so that braced initializers may be used as constructor arguments to it.

std::pair<std::string, std::vector<std::string>> p("hello", {});
tags: LWG, C++23, IS, plenary-approved

P1989 Range constructor for std::string_view 2: Constrain Harder (Corentin Jabot)

template<class R>
basic_string_view(R&&)
-> basic_string_view<ranges::range_value_t<R>>;
tags: LWG, ranges, C++23, plenary-approved

P2017 Conditionally safe ranges (Barry Revzin)

Several range adapters semantically behave as if they have a single member of some templated view type. If that underlying view type is a borrowed_range, the range adapter itself can be transitively borrowed.

tags: ranges, C++23, IS, size - small, plenary-approved

P2029 Proposed resolution for core issues 411, 1656, and 2333; escapes in character and string li…

tags: C++23, IS, plenary-approved

P2036 Changing scope for lambda trailing-return-type (Barry Revzin)

This paper proposes that name lookup in the trailing-return-type of a lambda first consider that lambda’s captures before looking further outward. We may not know at the time of parsing the return type which names actually are captured, so this paper proposes to treat all capturable entities as if they were captured.

tags: CWG, C++23, plenary-approved

P2071 Named universal character escapes (Tom Honermann, R. Martinho Fernandes, Peter Bindels, Corentin Jabot, Steve Downey)

A proposal to extend universal character names from hexadecimal sequences to include the official names and formal aliases of Unicode codepoints.

Before/After Table

Before:

// UTF-32 character literal with U+0100 {LATIN CAPITAL LETTER A WITH MACRON}
U'\u0100'
// UTF-8 string literal with U+0100 {LATIN CAPITAL LETTER A WITH MACRON} U+0300 {COMBINING GRAVE ACCENT}
u8"\u0100\u0300"

After:

U'\N{LATIN CAPITAL LETTER A WITH MACRON}' // Equivalent to U'\u0100'
u8"\N{LATIN CAPITAL LETTER A WITH MACRON}\N{COMBINING GRAVE ACCENT}" // Equivalent to u8"\u0100\u0300"
tags: CWG, straw-poll, C++23, plenary-approved

P2077 Heterogeneous erasure overloads for associative containers (Konstantin Boyarinov, Sergey Vinogradov; Ruslan Arutyunyan)

The authors propose heterogeneous erasure overloads for ordered and unordered associative containers, which add an ability to erase values or extract nodes without creating a temporary key_type object.

tags: LWG, C++23, IS, B2: Improvement, plenary-approved

P2093 Formatted output (Victor Zverovich)

A new I/O-agnostic text formatting library was introduced in C++20 ([FORMAT]). This paper proposes integrating it with standard I/O facilities via a simple and intuitive API achieving the following goals:

  • Usability
  • Unicode support
  • Good performance
  • Small binary footprint

Before/After Table

Before:

std::cout << std::format("Hello, {}!", name);

After:

std::print("Hello, {}!", name);
tags: LWG, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved

P2096 Generalized wording for partial specializations (James Touton)…

tags: C++23, IS, plenary-approved

P2128 Multidimensional subscript operator (Corentin Jabot, Isabella Muerte, Daisy Hollman, Christian Trott, Mark Hoemmen)

We propose that user-defined types can define a subscript operator with multiple arguments to better support multi-dimensional containers and views.

Before

template <class ElementType, class Extents>
class mdspan {
    template <class... IndexType>
    constexpr reference operator()(IndexType...);
};
int main() {
    int  buffer[2 * 3 * 4] = {};
    auto s                 = mdspan<int, extents<2, 3, 4>>(buffer);
    s(1, 1, 1)             = 42;
}

After

template <class ElementType, class Extents>
 class mdspan {
    template <class... IndexType>
    constexpr reference operator[](IndexType...);
};
int main() {
    int  buffer[2 * 3 * 4] = {};
    auto s                 = mdspan<int, extents<2, 3, 4>>(buffer);
    s[1, 1, 1]             = 42;
}
tags: CWG, C++23, plenary-approved

P2136 invoke<R> (Zhihao Yuan)

This paper proposes invoke_r, a variant of std::invoke that allows specifying the return type, realizing the semantics of INVOKE<R> rather than INVOKE.

tags: LWG, C++23, IS, plenary-approved

P2156 Allow Duplicate Attributes (Erich Keane)

The standard attributes noreturn, carries dependency, and deprecated all specify that they cannot appear more than once in an attribute-list, but there is no such prohibition if they appear in separate attribute-specifiers within a single attributespecifier-seq. Since intuitively these cases are equivalent, they should be treated the same, accepting duplicates in both or neither.

tags: CWG, C++23, plenary-approved

P2160 Locks lock lockables (wording for LWG 2363) (Tim Song)

tags: C++23, IS, size - medium, plenary-approved

P2162 Inheriting from std::variant (resolving LWG3052) (Barry Revzin)

tags: C++23, IS, size - small, plenary-approved

P2164 views::enumerate (Corentin Jabot)

A struct with 2 members, how hard can it be?

We propose a view enumerate whose value type is a struct with 2 members index and value tuple of two elements representing respectively the position and value of the elements in the adapted range.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B3 - addition, size - medium, plenary-approved

P2165 Compatibility between tuple, pair and tuple-like objects (Corentin Jabot)

We propose to make pair constructible from tuple and std::array We mandate tuple_cat and friends to be compatible with these types, and associative containers more compatible with them. The changes proposed in this paper make the use of std::pair unnecessary in new code

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, lwg-fullreview, B2 - improvement, size - medium, plenary-approved

P2166 A Proposal to Prohibit std::basic_string and std::basic_string_view construction from nullptr (Yuriy Chernyshov)

the behavior of std::basic_string::basic_string(const CharT* s) constructor is undefined if [s, s + Traits::length(s)) is not a valid range (for example, if s is a null pointer)

tags: LWG, C++23, IS, size - small, plenary-approved

P2167 Improved Proposed Wording for LWG 2114 (Daniel Krügler)

tags: LWG, C++23, tentatively-ready-for-plenary, B2 - improvement, size - small, plenary-approved, lwg-wording-only

P2173 Attributes on Lambda-Expressions (Daveed Vandevoorde, Inbal Levi, Ville Voutilainen)

This paper proposes a fix for Core Issue 2097, to allow attributes for lambdas, those attributes appertaining to the function call operator of the lambda.

auto lm = [] [[nodiscard, vendor::attr]] () -> int { return 42; };
tags: CWG, straw-poll, C++23, plenary-approved

P2186 Removing Garbage Collection Support (JF Bastien, Alisdair Meredith)

We propose removing (not deprecating) C++’s Garbage Collection support. Specifically, these five library functions:

  • declare_reachable
  • undeclare_reachable
  • declare_no_pointers
  • undeclare_no_pointers
  • get_pointer_safety

As well as the pointer_safety enum, the \_\_STDCPP_STRICT_POINTER_SAFETY\_\_ macro, and the Core Language wording.

tags: CWG, LWG, C++23, IS, plenary-approved

P2201 Mixed string literal concatenation (Jens Maurer)

String concatenation involving string-literals with encoding-prefixes mixing L”“, u8”“, u”“, and U”” is currently conditionally-supported with implementation-defined behavior. […] No meaningful use-case for such mixed concatenations is known.

This paper makes such mixed concatenations ill-formed.

tags: CWG, C++23, plenary-approved

P2210 Superior String Splitting (Barry Revzin)

Proposal Part 1

This paper proposes the following: Rename the existing views::split / ranges::split_view to views::lazy_split / ranges::lazy_split_view. Add base() member functions to the inner-iterator type to get back to the adapted range’s iterators.

Proposal Part 2

  1. Introduce a new range adapter under the name views::split / ranges::split_view with the following design:
    1. It can only support splitting forward-or-better ranges.
    2. Splitting a V will yield ~subrange<iterator_t<V>>~s, ensuring that the adapted range’s category is preserved. Splitting a bidirectional range gives out bidirectional subranges. Spltiting a contiguous range gives out contiguous subranges.
    3. views::split will not be const-iterable.

Example

auto ip = "127.0.0.1"s;
auto parts = ip | std::views::split('.')
                | std::views::transform([](std::span<char const> s){
                      int i;
                      std::from_chars(s.data(), s.data() + s.size(), i);
                      return i;
                  });
tags: LWG, ranges, C++23, IS, B2 - improvement, plenary-approved

P2212 Relax Requirements for time_point::clock (Alexey Dmitriev, Howard Hinnant)

We propose to relax the requirements on the Clock template parameter of std::chrono::time_point.

tags: C++23, IS, plenary-approved

P2216 std::format improvements (Victor Zverovich)

This paper proposes the following improvements to the C++20 formatting facility:

  • Improving safety via compile-time format string checks
  • Reducing binary code size of format_to
std::string s = std::format("{:d}", "I am not a number");

Becomes ill-formed

tags: LWG, C++23, IS, plenary-approved

P2223 Trimming whitespaces before line splicing (Corentin Jabot)

We propose to make trailing whitespaces after \ non-significant.

int main() {
int i = 1
// \
+ 42
;
return i;
}
tags: CWG, C++23, SG22, plenary-approved

P2227 Update normative reference to POSIX (Jonathan Wakely)

tags: C++23, IS, plenary-approved

P2231 Missing constexpr in std::optional and std::variant (Barry Revzin)

But even though the language provided the tools to make std::optional and std::variant completely constexpr-able, there was no such update to the library. This paper seeks to remedy that omission by simply adding constexpr to all the relevant places.

tags: LWG, C++23, IS, B2 - improvement, plenary-approved

P2236 C++ Standard Library Issues to be moved in Virtual Plenary, Nov. 2020 (Jonathan Wakely)

tags: info, C++23, plenary-approved

P2238 Core Language Working Group “tentatively ready” issues for the November, 2020 meeting (Will…

tags: info, C++23, plenary-approved

P2242 Non-literal variables (and labels and gotos) in constexpr functions (Ville Voutilainen)

This paper proposes to strike the restriction that a constexpr function cannot contain a definition of a variable of non-literal type (or of static or thread storage duration), or a goto statement, or an identifier label. The rationale is briefly that the mere presence of the aforementioned things in a function is not in and of itself problematic; we can allow them to be present, as long as constant evaluation doesn’t evaluate them.

Example

template <typename T>
constexpr bool f() {
    if (std::is_constant_evaluated()) {
        // ...
        return true;
    } else {
        T t;
        // ...
        return true;
    }
}
struct nonliteral {
    nonliteral();
};
static_assert(f<nonliteral>());
tags: CWG, C++23, plenary-approved

P2246 Character encoding of diagnostic text (Aaron Ballman)

The standard provides a few mechanisms that suggest an implementation issues a diagnostic based on text written in the source code. However, the standard does not uniformly address what should happen if the execution character set of the compiler cannot represent the text in the source character set.

Because the display of diagnostic messages should be merely a matter of Quality of Implementation, the proposal is to place no character set related requirements on the diagnostic output with the understanding that implementations will do what makes the most sense for their situation when issuing diagnostics in terms of which characters need to be escaped or otherwise handled in a special way.

tags: CWG, C++23, plenary-approved

P2251 Require span & basic_string_view to be Trivially Copyable (Nevin Liber)

Given its definition, it is strongly implied that span & basic_string_view are trivially copyable, but that is not yet a requirement.

tags: LWG, C++23, IS, plenary-approved

P2255 A type trait to detect reference binding to temporary (Tim Song)

This paper proposes adding two new type traits with compiler support to detect when the initialization of a reference would bind it to a lifetime-extended temporary, and changing several standard library components to make such binding ill-formed when it would inevitably produce a dangling reference.

Before

std::tuple<const std::string&>      x("hello");            // dangling
std::function<const std::string&()> f = [] { return ""; }; // OK

f(); // dangling

After

std::tuple<const std::string&>      x("hello");            // ill-formed
std::function<const std::string&()> f = [] { return ""; }; // ill-formed
tags: LWG, C++23, IS, small, plenary-approved, expedited-library-evolution-electronic-poll

P2259 Repairing input range adaptors and counted_iterator (Tim Song)

This paper proposes fixes for several issues with iterator_category for range and iterator adaptors. This resolves [LWG3283], [LWG3289], and [LWG3408].

This code does not compile:

std::vector<int> vec = {42};
auto r = vec | std::views::transform([](int c) { return std::views::single(c);})
             | std::views::join
             | std::views::filter([](int c) { return c > 0; });
r.begin();
tags: C++23, IS, plenary-approved

P2266 Simpler implicit move (Arthur O’Dwyer)

In C++20, return statements can implicitly move from local variables of rvalue reference type; but a defect in the wording means that implicit move fails to apply to functions that return references. C++20’s implicit move is specified via a complicated process involving two overload resolutions, which is hard to implement, causing implementation divergence. We fix the defect and simplify the spec by saying that a returned move-eligible id-expression is always an xvalue.

tags: CWG, straw-poll, C++23, plenary-approved

P2273 Making std::unique_ptr constexpr (Andreas Fertig)

std::unique_ptr is currently not constexpr friendly. With the loosening of requirements on constexpr in [P0784R10] and the ability to use new and delete in a constexpr­context, we should also provide a constexpr std::unique_ptr.

Example

constexpr auto fun() {
    auto p = std::make_unique<int>(4);
    return *p;
}
int main() {
    constexpr auto i = fun();
    static_assert(4 == i);
}
tags: LWG, C++23, B2 - improvement, plenary-approved, constexpr, expedited-library-evolution-electronic-poll

P2278 cbegin should always return a constant iterator (Barry Revzin)

cbegin should always return a constant iterator.

Proposal

We can resolve this by extending std::ranges::cbegin and std::ranges::cend to conditionally wrap their provided range’s iterator/sentinel pairs to ensure that the result is a constant iterator, and use these tools to build up a views::as_const range adapter. This completely solves the problem without any imposed boilerplate per range.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P2280 Using unknown references in constant expressions (Barry Revzin)

template <typename T, size_t N>
constexpr auto array_size(T (&)[N]) -> size_t {
    return N;
}

void check(int const (&param)[3]) {
    int            local[] = {1, 2, 3};
    constexpr auto s0      = array_size(local); // ok
    constexpr auto s1      = array_size(param); // error
}

The proposal is to allow all these cases to just work. That is, if during constant evaluation, we run into a reference with unknown origin, this is still okay, we keep going. Similarly, if we run into a pointer with unknown origin, we allow indirecting through it.

tags: CWG, straw-poll, C++23, plenary-approved

P2281 Clarifying range adaptor objects (Tim Song)

The wording below clarifies that the partial application performed by range adaptor objects is essentially identical to that performed by bind_front. (Indeed, it is effectively a limited version of bind_back.) In particular, this means that the bound arguments are captured by copy or move, and never by reference. Invocation of the pipeline then either copies or moves the bound entities, depending on the value category of the pipeline.

Example

auto c = /* some range */;
auto f = /* expensive-to-copy function object */;
c | transform(f); // copies f and then move it into the view

auto t = transform(f); // copies f
c | t;                 // copies f again from t
c | std::move(t);      // moves f from t
tags: LWG, C++23, plenary-approved

P2286 Formatting Ranges (Barry Revzin)

[LWG3478] addresses the issue of what happens when you split a string and the last character in the string is the delimiter that you are splitting on. One of the things I wanted to look at in research in that issue is: what do other languages do here?

For most languages, this is a pretty easy proposition. Do the split, print the results. This is usually only a few lines of code.

Python

print("xyx".split("x"))
['', 'y', '']

Java

import java.util.Arrays;

class Main {
  public static void main(String args[]) {
    System.out.println("xyx".split("x"));
    System.out.println(Arrays.toString("xyx".split("x")));
  }
}
[Ljava.lang.String;@76ed5528
[, y]

rust

use itertools::Itertools;

fn main() {
    println!("{:?}", "xyx".split('x'));
    println!("[{}]", "xyx".split('x').format(", "));
    println!("{:?}", "xyx".split('x').collect::<Vec<_>>());
}
Split(SplitInternal { start: 0, end: 3, matcher: CharSearcher { haystack: "xyx", finger: 0, finger_back: 3, needle: 'x', utf8_size: 1, utf8_encoded: [120, 0, 0, 0] }, allow_trailing_empty: true, finished: false })
[, y, ]
["", "y", ""]

C++

#include <iostream>
#include <string>
#include <ranges>

int main() {
    // need to predeclare this because we can't split an rvalue string
    std::string s     = "xyx";
    auto        parts = s | std::views::split('x');

    std::cout << "[";
    char const* delim = "";
    for (auto part : parts) {
        std::cout << delim;
        // this finally works
        for (char c : part) {
            std::cout << c;
        }
        delim = ", ";
    }
    std::cout << "]\n";
}
[, y, ]

lib fmt

#include <ranges>
#include <string>
#include <fmt/ranges.h>

int main() {
    std::string s = "xyx";
    auto parts = s | std::views::split('x');

    fmt::print("{}\n", parts);
    fmt::print("<<{}>>\n", fmt::join(parts, "--"));
}
[[], ['y'], []]
<<[]--['y']--[]>>
tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved

P2290 Delimited escape sequences (Corentin Jabot)

We propose an additional, clearly delimited syntax for octal, hexadecimal and universal character name escape sequences.

We propose new syntaxes \u{}, \o{}, \x{} usable in places where \u, \x, \nnn currently are. \o{} accepts an arbitrary number of octal digits while \u{} and \x{} accept an arbitrary number of hexadecimal digit.

tags: CWG, straw-poll, C++23, plenary-approved

P2291 Add Constexpr Modifiers to Functions to_chars and from_chars for Integral Types in <charconv> Header (Daniil Goncharov, Karaev Alexander)

There is currently no standard way to make conversion between numbers and strings at compile time.

std::to_chars and std::from_chars are fundamental blocks for parsing and formatting being localeindependent and non-throwing without memory allocation, so they look like natural candidates for constexpr string conversions. The paper proposes to make std::to_chars and std::from_chars functions for integral types usable in constexpr context.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved, constexpr, expedited-library-evolution-electronic-poll

P2295 Correct UTF-8 handling during phase 1 of translation (Corentin Jabot, Peter Brett)

We propose that UTF-8 source files should be supported by all C++ compilers.

tags: CWG, straw-poll, C++23, plenary-approved

P2301 Add a pmr alias for std::stacktrace (Steve Downey)

This paper proposes to add an alias in the pmr namespace defaulting the allocator used by the std::basic_stacktrace template to pmr::allocator. No changes to the api of std::stacktrace are necessary.

Before

char buffer[1024];

std::pmr::monotonic_buffer_resource pool{
    std::data(buffer), std::size(buffer)};

std::basic_stacktrace<
    std::pmr::polymorphic_allocator<std::stacktrace_entry>>
    trace{&pool};

After

char buffer[1024];

std::pmr::monotonic_buffer_resource pool{
    std::data(buffer), std::size(buffer)};

std::pmr::stacktrace trace{&pool};
tags: LWG, C++23, tiny, plenary-approved

P2302 Prefer std::ranges::contains over std::basic_string_view::contains (Christopher Di Bella)

P2302 proposes two algorithms: one that checks whether or not a range contains an element, and one that checks whether or not a range contains a subrange

Before:

namespace stdr = std::ranges;
stdr::find(haystack.begin(), haystack.end(), 'o') != haystack.end()
stdr::find(haystack, 'o') != stdr::end(haystack)
not stdr::search(haystack, long_needle).empty()
not stdr::search(haystack, long_needle, bind_back(std::modulo(), 4)).empty()

After:

namespace stdr = std::ranges;
stdr::contains(haystack.begin(), haystack.end(), 'o')
stdr::contains(haystack, 'o')
stdr::contains_subrange(haystack, long_needle)
stdr::contains_subrange(haystack, long_needle, bind_back(std::modulo(), 4))
tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved

P2313 Core Language Working Group “tentatively ready” issues for the February, 2021 mee…

tags: CWG, info, C++23, plenary-approved

P2314 Character sets and encodings (Jens Maurer)

This paper implements the following changes:

  • Switch C++ to a modified “model C” approach for universal-character-names as described in the C99 Rationale v5.10, section 5.2.1.
  • Introduce the term “literal encoding”. For purposes of the C++ specification, the actual set of characters is not relevant, but the sequence of code units (i.e. the encoding) specified by a given character or string literal are. The terms “execution (wide) character set” are retained to describe the locale-dependent runtime character set used by functions such as isalpha.
  • (Not a wording change) Do not attempt to treat all string literals the same; their treatment depends on (phase 7) context.

Before/After Table

Before:

#define S(x) # x
const char * s1 = S(Köppe);       // "K\\u00f6ppe"
const char * s2 = S(K\u00f6ppe);  // "K\\u00f6ppe"

After:

#define S(x) # x
const char * s1 = S(Köppe);       // "Köppe"
const char * s2 = S(K\u00f6ppe);  // "Köppe"
tags: CWG, C++23, plenary-approved

P2315 C++ Standard Library Issues to be moved in Virtual Plenary, Feb. 2021 (Jonathan Wakely)

tags: LWG, info, C++23, plenary-approved

P2316 Consistent character literal encoding (Corentin Jabot)

Character literals in preprocessor conditional should behave like they do in C++ expression.

#if 'A' == '\x41'
//...
#endif
if ('A' == 0x41){}
tags: CWG, C++23, plenary-approved

P2321 zip (Tim Song)

This paper proposes

  • four views, zip, zip_transform, adjacent, and adjacent_transform,
  • changes to tuple and pair necessary to make them usable as proxy references (necessary for zip and adjacent), and
  • changes to vector<bool>::reference to make it usable as a proxy reference for writing,

cccgs** Example

std::vector v1 = {1, 2};
std::vector v2 = {'a', 'b', 'c'};
std::vector v3 = {3, 4, 5};

fmt::print("{}\n", std::views::zip(v1, v2));                              // {(1, 'a'), (2, 'b')}
fmt::print("{}\n", std::views::zip_transform(std::multiplies(), v1, v3)); // {3, 8}
fmt::print("{}\n", v2 | std::views::pairwise);                            // {('a', 'b'), ('b', 'c')}
fmt::print("{}\n", v3 | std::views::pairwise_transform(std::plus()));     // {7, 9}
tags: LWG, ranges, C++23, IS, B3 - addition, plenary-approved

P2322 ranges::fold (Barry Revzin)

While we do have an iterator-based version of fold in the standard library, it is currently named accumulate, defaults to performing + on its operands, and is found in the header <numeric>. But fold is much more than addition, so as described in the linked paper, it’s important to give it the more generic name and to avoid a default operator.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved

P2324 Labels at the end of compound statements (C compatibility) (Martin Uecker)

WG14 adopted a change for C2X that allows placement of labels everywhere inside a compound statement (N2508). While this improves compatibility with C++ which previously diverged from C by allowing labels in front of declarations, there is still a remaining incompatibility: C now does allow labels at the end of a compound statement, while C++ does not. It is proposed to change the C++ grammar to remove this remaining difference.

Example

void foo(void)
{
first: // allowed in C++, now also allowed in C
int x;
second: // allowed in both C++ and C
x = 1;
last: // not allowed in C++, but now allowed in C
}
tags: CWG, straw-poll, C++23, size - small, plenary-approved

P2325 Views should not be required to be default constructible (Barry Revzin)

Currently, the view concept is defined in 24.4.4 [range.view] as:

template <class T>
concept view =
    range<T> &&
    movable<T> &&
    default_initializable<T> &&
    enable_view<T>;

Discussion

Three of these four criteria, I understand. A view clearly needs to be a range, and it’s important that they be movable for various operations to work. And the difference between a view and range is largely semantic, and so there needs to be an explicit opt-in in the form of enable_view.

But why does a view need to be default_initializable?

tags: LWG, ranges, C++23, IS, B2 - improvement, plenary-approved

P2327 De-deprecating volatile compound assignment (Paul Bendixen, Jens Maurer, Arthur O’Dwyer, Ben Saks)

The C++ 20 standard deprecated many functionalities of the volatile keyword. This was due to P1152[Bastien, 2019]. The reasoning is given in the R0 version of the paper[Bastien, 2018].

The deprecation was not received too well in the embedded community as volatile is commonly used for communicating with peripheral devices in microcontrollers[van Ooijen, 2020].

The purpose of this paper is to give a solution that will not undo what was achieved with P1152, and still keep the parts that are critical to the embedded community.

tags: CWG, straw-poll, C++23, plenary-approved

P2328 join_view should join all views of ranges (Tim Song)

This paper proposes relaxing the constraint on join_view to support joining ranges of prvalue non-view ranges.

tags: LWG, ranges, C++23, IS, B2: Improvement, plenary-approved

P2334 Add support for preprocessing directives elifdef and elifndef (Melanie Blower)

This paper is being submitted as a liaison activity from WG14 C Language Working Group. The proposal was discussed in the March 2021 meeting and approved (15 in favor, 1 opposed, 4 abstentions) for inclusion into C23. This paper is being proposed to WG21 to avoid preprocessor incompatibilities with C and because the utility is valuable to C++ users of the preprocessor.

tags: CWG, C++23, plenary-approved

P2340 Clarifying the status of the ‘C headers’ (Thomas Köppe)

We propose to move the specification of “[depr.c.headers] C headers” from Annex D into the main document, and changing those headers’ status from “deprecated” to an explicitly discussed state “for foreign-language interoperability only”.

tags: LWG, C++23, policy, IS, B2 - improvement, size - small, plenary-approved

P2360 Extend init-statement to allow alias-declaration (Jens Maurer)

Before:

for (typedef int T; T e : v)
  /* something */;

After:

for (using T = int; T e : v)
  /* something */;
tags: CWG, C++23, plenary-approved

P2362 Make obfuscating wide character literals ill-formed (Peter Brett, Corentin Jabot)

C++ currently permits writing a wide character literal with multiple characters or characters that cannot fit into a single wchar_t codeunit. For example:

Example

wchar_t a = L'🤦'; // \u{1F926}
wchar_t b = L'ab';
wchar_t c = L'é'; // \u{65}\u{301};

Make these literals ill-formed.

tags: CWG, straw-poll, C++23, plenary-approved

P2367 Remove misuses of list-initialization from Clause 24 (Tim Song)

This paper provides wording for [LWG3524] and resolves related issues caused by the erroneous use of list-initialization in ranges wording.

As discussed in [LWG3524], the use of list-initialization in the ranges specification implies ordering guarantees that are unintended and unimplementable in ordinary C++, as well as narrowing checks that are unnecessary and sometimes unimplementable.

tags: LWG, C++23, plenary-approved

P2372 Fixing locale handling in chrono formatters (Victor Zverovich, Corentin Jabot)

In C++20 “Extending <chrono> to Calendars and Time Zones” ([P0355]) and “Text Formatting” ([P0645]) proposals were integrated ([P1361]). Unfortunately during this integration a design issue was missed: std::format is locale-independent by default and provides control over locale via format specifiers but the new formatter specializations for chrono types are localized by default and don’t provide such control.

Solution

We propose fixing this issue by making chrono formatters locale-independent by default and providing the L specifier to opt into localized formatting in the same way as it is done for all other standard formatters (format.string.std).

Before:

auto s = std::format("{:%S}", sec(4.2));
// s == "04,200"

auto s = std::format("{:L%S}", sec(4.2));
// throws format_error

After:

auto s = std::format("{:%S}", sec(4.2));
// s == "04.200"

auto s = std::format("{:L%S}", sec(4.2));
// s == "04,200"
tags: LWG, C++23, IS, plenary-approved

P2374 views::cartesian_product (Sy Brand, Michał Dominiak )

This paper proposes std::ranges::cartesian_product_view for taking the cartesian product of multiple forward ranges.

Before

std::vector<int> a,b,c;
for (auto&& ea : a) {
    for (auto&& eb : b) {
        for (auto&& ec : c) {
            use(ea,eb,ec);
        }
    }
}

After

std::vector<int> a,b,c;
for (auto&& [ea,eb,ec] : std::views::cartesian_product(a,b,c)) {
    use(ea,eb,ec);
}
tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P2385 C++ Standard Library Issues to be moved in Virtual Plenary, June 2021 (Jonathan Wakely)

tags: info, C++23, plenary-approved

P2386 Core Language Working Group “ready” Issues for the June, 2021 meeting (William M....

tags: info, C++23, plenary-approved

P2387 Pipe support for user-defined range adaptors (Barry Revzin)

Walter Brown made an excellent observation: if we gave users the tools to write their own range adaptors that would properly inter-operate with standard library adaptors (as well as other users’ adaptors), then it becomes less important to provide more adaptors in the standard library.

The goal of this paper is provide that functionality: provide a standard customization mechanism for range adaptors, so that everybody can write their own adaptors.

tags: LWG, ranges, C++23, IS, B2 - improvement, size - medium, plenary-approved

P2393 Cleaning up integer-class types (Tim Song)

This paper revamps the specification and use of integer-class types to resolve a number of issues, including [LWG3366], [LWG3376], and [LWG3575].

tags: LWG, C++23, plenary-approved

P2401 Add a conditional noexcept specification to std::exchange (Giuseppe D’Angelo)

We propose to add a noexcept-specification to std::exchange , which is currently lacking one.

tags: LWG, C++23, IS, plenary-approved

P2404 Relaxing equality_comparable_with’s and three_way_comparable_with’s common reference requir…

None of equality_comparable_with, totally_ordered_with, or three_way_comparable_with support move-only types. For move-only types, these concept’s common reference requirement currently ends up requiring that the two types const T& and const U& can be converted to the non-reference common_reference_t, meaning that it requires T and U to be copyable. This common reference requirement should be relaxed to support these move-only types, effectively turning the common reference requirement into a common supertype requirement, as the original reason to require formable references no longer exists.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, expedited-library-evolution-electronic-poll

P2408 Ranges views as inputs to non-Ranges algorithms (David Olsen)

Change the iterator requirements for non-Ranges algorithms. For forward iterators and above that are constant iterators, instead of requiring that iterators meet certain Cpp17…Iterator requirements, require that the iterators model certain iterator concepts. This makes iterators from several standard views usable with non-Ranges algorithms that require forward iterators or above, such as the parallel overloads of most algorithms.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, plenary-approved

P2415 What is a view? (Barry Revzin, Tim Song)

Once upon a time, a view was a cheaply copyable, non-owning range. We’ve already somewhat lost the “cheaply copyable” requirement since views don’t have to be copyable, and now this paper is suggesting that we also lose the non-owning part.

tags: LWG, ranges, C++23, IS, B2 - improvement, size - medium, plenary-approved

P2417 A more constexpr bitset (Daniil Goncharov)

constexpr bitset will allow to naturally use them as flags-mask in constexpr/consteval functions. It’s add, without limitations, new high-level and more user-friendly class for bit mask in embedded developing.

Proposal

Mark every member function except iostream operators. Make all of bitset::reference constexpr.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B3 - addition, size - medium, plenary-approved, constexpr, expedited-library-evolut…

P2418 Add support for std::generator-like types to std::format (Victor Zverovich)

Unfortunately we cannot make std::generator formattable because it is neither const-iterable nor copyable and std::format takes arguments by const&.

This paper proposes solving the issue by making std::format and other formatting functions take arguments by forwarding references.

tags: LWG, C++23, IS, B2 - improvement, size - medium, plenary-approved

P2419 Clarify handling of encodings in localized formatting of chrono types (Victor Zverovich)

C++20 added formatting of chrono types with std::format but left unspecified what happens during localized formatting when the locale and literal encodings do not match ([LWG3565]).

Proposal

We propose clarifying the specification to prevent mojibake when possible by allowing implementation do transcoding or substituting the locale so that the result is in a consistent encoding.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, lwg-fullreview, B2 - improvement, size - tiny, plenary-approved

P2432 Fix istream_view (Nicolai Josuttis)

This paper fixes a fundamental design problem with the current helper function std::ranges::istream_view<>() that cause multiple inconsistences and unnecessary code overhead when declaring istream_view objects

Before:

std::ranges::istream_view<int> v{mystream}
 // ERROR

After:

std::ranges::istream_view<int> v{mystream}
 // OK
tags: LWG, ranges, C++23, IS, B2 - improvement, size - small, plenary-approved

P2437 Support for #warning (Aaron Ballman)

Almost all major C++ compilers support the #warning preprocessing directive to generate a diagnostic message from the preprocessor without stopping translation, as #error does, which can be useful for code authors who want to warn consumers of the code about non-fatal concerns.

WG14 considered a similar proposal as part of WG14 N2686 at our Sept 2021 meeting and adopted the feature into C23 (straw poll results were: 17 in favor, 0 oppose, 1 abstain). The WG21 proposal is functionally identical to the WG14 proposal, with the only difference being due to existing variance in specification around how #error causes translation to stop.

tags: CWG, straw-poll, C++23, size - tiny, plenary-approved

P2438 std::string::substr() && (Federico Kircheis, Tomasz Kamiński)

auto foo() -> std::string;

auto b = foo().substr(/* */);

Before:

foo() returns a temporary std::string. .substr creates a new string and copies the relevant content. At last, the temporary string returned by foo is released.

After:

foo() returns a std::string. .substr implementation can reuse the storage of the string returned by foo and leave it in a valid but unspecified state. At last, the temporary string returned by foo() is released.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, expedited-library-evolution-electronic-poll

P2440 ranges::iota, ranges::shift_left, and ranges::shift_right (Tim Song)

This paper proposes adding the algorithms ranges::iota, ranges::shift_left, and ranges::shift_right, to match their std counterparts.

tags: LWG, ranges, C++23, IS, B3 - addition, size - medium, plenary-approved

P2441 views::join_with (Barry Revzin)

The behavior of views::join_with is an inverse of views::split. That is, given a range r and a pattern p, r | views::split(p) | views::join_with(p) should yield a range consisting of the same elements as r.

tags: LWG, ranges, C++23, IS, plenary-approved

P2442 Windowing range adaptors: views::chunk and views::slide (Tim Song)

This paper proposes two range adaptors, views::chunk and views::slide, as described in section 3.5 of [P2214R0].

std::vector v = {1, 2, 3, 4, 5};
fmt::print("{}\n", v | std::views::chunk(2));   // [[1, 2], [3, 4], [5]]
fmt::print("{}\n", v | std::views::slide(2));   // [[1, 2], [2, 3], [3, 4], [4, 5]]
tags: LWG, ranges, C++23, IS, B3 - addition, size - medium, plenary-approved

P2443 views::chunk_by (Tim Song)

This paper proposes the range adaptor views::chunk_by as described in section 4.3 of [P2214R1].

std::vector v = {1, 2, 2, 3, 0, 4, 5, 2};
fmt::print("{}\n", v | std::views::chunk_by(ranges::less_equal{}));   // [[1, 2, 2, 3], [0, 4, 5], [2]]
tags: LWG, ranges, C++23, IS, B3 - addition, size - medium, plenary-approved

P2445 forward_like (Gašper Ažman)

Deducing This [P0847R7] is expected to land in C++23. Its examples use a hypothetical std::forward_like<decltype(self)>(variable) facility because std::forward<decltype(v)>(v) is insufficient. This paper proposes std::forward_like to cater to this scenario.

Example

auto callback = [m = get_message(), &scheduler](this auto&& self) -> bool {
    return scheduler.submit(std::forward_like<decltype(self)>(m));
};
callback();            // retry(callback)
std::move(callback)(); // try-or-fail(rvalue)
tags: LWG, C++23, tentatively-ready-for-plenary, IS, B3 - addition, size - small, plenary-approved

P2446 views::move (Barry Revzin)

as_rvalue_view presents a view of an underlying sequence with the same behavior as the underlying sequence except that its elements are rvalues. Some generic algorithms can be called with a as_rvalue_view to replace copying with moving.

The name views::as_rvalue denotes a range adaptor object ([range.adaptor.object]).

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P2448 Relaxing some constexpr restrictions (Barry Revzin)

There are two rules about constexpr programming that make code ill-formed or ill-formed (no diagnostic required) when functions or function templates are marked constexpr that might never evaluate to a constant expression. But… so what if they don’t? The goal of this paper is to stop diagnosing problems that don’t exist.

tags: CWG, straw-poll, C++23, plenary-approved

P2450 C++ Standard Library Issues to be moved in Virtual Plenary, Oct. 2021 (Jonathan Wakely)

tags: LWG, C++23, plenary-approved

P2460 Relax requirements on wchar_t to match existing practices (Corentin Jabot)

We propose to remove the constraints put on the encoding associated with wchar_t in the core wording.

Proposal

Type wchar_t is a distinct type that has an implementation-defined signed or unsigned integer type as its underlying type. The values of type wchar_t can represent distinct codes for all members of the largest extended character set specified among the supported locales.

tags: CWG, LWG, straw-poll, C++23, tentatively-ready-for-plenary, IS, lwg-fullreview, B2 - improvement, size - small, plenary-approved, …

P2462 Core Language Working Group “ready” issues for the October, 2021 meeting (Willi…

tags: CWG, C++23, plenary-approved

P2465 Standard Library Modules std and std.all (Stephan T. Lavavej, Gabriel Dos Reis, Bjarne Stroustrup, Jonathan Wakely)

Header files are a major source of complexity, errors caused by dependencies, and slow compilation. Modules address all three problems, but are currently hard to use because the standard library is not offered in a module form. This note presents logical arguments and a few measurements that demonstrates that import std of a module std presenting all of the standard library can compile many times faster than plain old #include <iostream>.

As adopted

This paper provides Standardese for two named modules: std and std.compat.

import std; imports everything in namespace std from C++ headers (e.g. std::sort from <algorithm>) and C wrapper headers (e.g. std::fopen from <cstdio>). It also imports ::operator new etc. from <new>.

import std.compat; imports all of the above, plus the global namespace counterparts for the C wrapper headers (e.g. ::fopen).

tags: CWG, LWG, straw-poll, C++23, tentatively-ready-for-plenary, IS, modular-standard-library, size - large, plenary-approved

P2467 Support exclusive mode for fstreams (Jonathan Wakely)

Historically, C++ iostreams libraries had a noreplace open mode that corresponded to the O_EXCL flag for POSIX open. That mode was not included in the C++98 standard, presumably for portability reasons, because it wasn’t in ISO C90.

Since then, ISO C added support for “exclusive” mode to fopen, so now C++’s <fstream> is missing a feature that is present in both ISO C and POSIX. We should fix this for C++23.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved, expedited-library-evolution-electronic-poll

P2468 The Equality Operator You Are Looking For (Barry Revzin, Bjarne Stroustrup, Cameron DaCamara, Daveed Vandevoorde, Gabriel Dos Reis, Herb Sutter, Jason Merrill, Jonathan Caves, Richard Smith, Ville Voutilainen)

This paper details some changes to make rewriting equality in expressions less of a breaking change

  • If you want an operator== that is used for rewrites (automatically reversed, and != automatically generated), write only an operator==, and make sure its return type is bool.
  • If you want an operator== that is not used for rewrites, write both an operator== and a matching operator!=.
  • operator<=> is always used for rewrites (from <, <=, >, >=); if you don’t want rewrites, don’t write an operator<=>.
tags: CWG, straw-poll, C++23, plenary-approved

P2474 views::repeat (Michał Dominiak)

This paper proposes a new range factory, views::repeat, which creates a range that repeats the same value either infinitely, or a specified number of times.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B3 - addition, size - small, plenary-approved, expedited-library-evolution-…

P2493 Missing feature test macros for C++20 core papers (Barry Revzin)

As Jonathan Wakely pointed out on the SG10 mailing list, neither [P0848R3] (Conditionally Trivial Special Member Functions) nor [P1330R0] ( Changing the active member of a union inside constexpr) provided a feature-test macro.

This paper proposes Richard’s second suggestion: bump __cpp_concepts and __cpp_constexpr to 202002L

tags: CWG, straw-poll, C++23, plenary-approved

P2494 Relaxing range adaptors to allow for move only types (Michał Dominiak)

Currently, many range adaptors require that the user-provided types they store must be copy constructible, which is also required by the assignment wrapper they use, copyable-box.

Similarly to how [P2325R3] turned semiregular-box into copyable-box, this paper proposes to turn copyable-box into movable-box. This name is probably not ideal, because it still turns types that happen to be copy constructible into copyable types, but it follows from the prior changes to the wrapper.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, plenary-approved

P2499 string_view range constructor should be explicit (James Touton)

P1989R2 added a new constructor to basic_string_view that allows for implicit conversion from any contiguous range of the corresponding character type. This implicit conversion relies on the premise that a range of char is inherently string-like. While that premise holds in some situations, it is hardly universally true, and the implicit conversion is likely to cause problems. This paper proposes making the conversion explicit instead of implicit in order to avoid misleading programmers.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P2502 std::generator: Synchronous Coroutine Generator for Ranges (Casey Carter)

We propose a standard library type std::generator which implements a coroutine generator that models std::ranges::input_range.

Example

std::generator<int> fib() {
    auto a = 0, b = 1;
    while (true) {
        co_yield std::exchange(a, std::exchange(b, a + b));
    }
}
int answer_to_the_universe() {
    auto rng = fib() | std::views::drop(6) | std::views::take(3);
    return std::ranges::fold_left(std::move(range), 0, std::plus{});
}
tags: LWG, coroutines, ranges, C++23, tentatively-ready-for-plenary, IS, B1 - focus, plenary-approved

P2505 Monadic Functions for std::expected (Jeff Garland)

With the final plenary vote of P0798 Monadic Functions for std::optional complete, we now have an design inconsistency with std::expected. P0323 std::expected has now also been voted into the working draft for C++23. This proposal corrects the inconsistency by adding 4 functions to std::expected and is targeted at C++23. The author believes this should be treated as a consistency/bug fix still in scope for C++23.

Proposal

The following 3 functions are added to std::optional, but are currently not part of std::expected.

and_then
compose a chain of functions returning an expected
or_else
returns if it has a value, otherwise it calls a function with the error type
transform
apply a function to change the value (and possibly the type)

After feedback, this draft also proposes the addition of two additional functions for expected to facilitate additional cases:

transform_error
apply a function to change the value, otherwise call a function with error type
error_or
a value to return when there is not an error
tags: LWG, C++23, IS, lwg-fullreview, B2 - improvement, size - small, plenary-approved

P2508 Exposing std::basic-format-string (Barry Revzin)

In 20.20.1 [format.syn], replace the exposition-only names basic-format-string, format-string, and wformat-string with the non-exposition-only names basic_format_string, format_string, and wformat_string.

Example

template <typename... Args>
void log(std::format_string<Args...> s, Args&&... args) {
    if (logging_enabled) {
        log_raw(std::format(s, std::forward<Args>(args)...));
    }
}
tags: LWG, C++23, tentatively-ready-for-plenary, IS, B3 - addition, plenary-approved

P2513 char8_t Compatibility and Portability Fixes (JeanHeyd Meneide, Tom Honermann)

char8_t has compatibility problems and issues during deployment that people have had to spend energy working around. This paper aims to alleviate some of those compatibility problems, for both C and C++, around string and character literals for the char8_t type.

tags: CWG, straw-poll, C++23, B2 - improvement, plenary-approved

P2517 Add a conditional noexcept specification to std::apply (Hewill Kang)

This paper proposes to add a noexcept-specification to std::apply.

invoke(f, args...) should be completely equivalent to apply(f, forward_as_tuple(args...)), adding noexcept to apply can easily achieve this and make it more consistent with invoke.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, lwg-fullreview, plenary-approved

P2520 move_iterator should be a random access iterator (Barry Revzin)

move_iterator<T*> should be a random access iterator

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved, expedited-library-evoluti…

P2539 Should the output of std::print to a terminal be synchronized with the underlying stream? (…

To prevent mojibake std::print may use a native Unicode API when writing to a terminal bypassing the stream buffer. During the review of [P2093] “Formatted output” Tim Song suggested that synchronizing std::print with the underlying stream may be beneficial for gradual adoption. This paper presents motivating examples, observes that this problem doesn’t normally happen in practice and proposes a minor update to the wording to provide a synchronization guarantee.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved

P2540 Empty Product for certain Views (Steve Downey)

This paper argues that the Cartesian product of no ranges should be a single empty tuple, which is the identity element for Cartesian products. Other product-like views, however, should not automatically have their identity be the result, and in particular for zip, as it would introduce unsound inconsistencies.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P2549 std::unexpected should have error() as member accessor (Yihe Li)

Before change:

void fun()
{
    using namespace std::literals;
    using ET = std::expected<int, std::string>;
    auto unex = std::unexpected("Oops"s);
    auto wrapped = unex.value(); // okay, get "Oops"
    auto ex = ET(unex); // implicit, can also happen in parameter passing, etc.
    auto wrapped2 = ex.value(); // throws!
}

After change:

void fun()
{
    using namespace std::literals;
    using ET = std::expected<int, std::string>;
    auto unex = std::unexpected("Oops"s);
    auto wrapped = unex.error(); // okay, get "Oops"
    auto ex = ET(unex); // implicit, can also happen in parameter passing, etc.
    auto wrapped2 = ex.error(); // okay, get "Oops" too.
}
tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved

P2553 Make mdspan size_type controllable (Christian Trott, Damien Lebrun-Grandie, Mark Hoemmen, K. R. Walker, Daniel Sunderland)

P0009 explicitly sets the size_type of extents to size_t, which is then used by layout mappings and mdspan. While this matches span whose extent function returns size_t, this behavior has significant performance impact on various architectures where 64-bit integer throughput is significantly lower than 32-bit integer computation throughput.

Proposal:

All in all we prefer the option of making extents require the additional argument (2.2.2), with the next best thing being the introduction basic_extents and making extents an alias to basic_extents with size_t as the size_type. If LEWG would prefer the second option, the wording is largely the same with the following changes at the end:

  • Rename extents to basic_extents throughout P0009 and
  • Add an alias in [mdspan.syn]:
template<size_t ... Extents>
using extents = basic_extents<size_t, Extents...>;
tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, mdspan

P2554 C-Array Interoperability of MDSpan (Christian Trott, Damien Lebrun-Grandie, Mark Hoemmen, K. R. Walker, Daniel Sunderland)

We cannot currently fix the multidimensional c-array construction, since it is UB to alias a nested C-Array with a element type pointer - per discussion on the C++ committee reflector in January 2022. However, in practice it works (on the compilers we tested e.g. clang-based and gcc) - and it may be something the committee changes in the future - i.e. make it not-UB. We propotyped this capability, which requires an additional constructor from c-array and a few deduction guides.

What we can fix today is the deduction from 1D c-array, by adding a deduction guide from c-array constraint to rank-1 arrays.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, mdspan

P2564 consteval needs to propagate up (Barry Revzin)

This paper proposes avoiding the consteval coloring problem (or, at least, mitigating its annoyances) by allowing certain existing constexpr functions to implicitly become consteval functions when those functions can already only be invoked during compile time anyway.

Specifically, these three rules:

  1. If a constexpr function contains a call to an immediate function outside of an immediate function context, and that call itself isn’t a constant expression, said constexpr function implicitly becomes a consteval function. This is intended to include lambdas, function template specializations, special member functions, and should cover member initializers as well.
  2. If an expression-id designates a consteval function without it being an immediate call in such a context, it also makes the context implicitly consteval. Such expression-id’s are also allowed in contexts that are manifestly constant evaluated.
  3. Other manifestly constant evaluated contexts (like constant-expression and the condition of a constexpr if statement) are now considered to be immediate function contexts.
tags: CWG, straw-poll, C++23, nb-comment, plenary-approved

P2579 Mitigation strategies for P2036 ”Changing scope for lambda trailing-return-type” (Corentin Jabot)

P2036R3 was adopted for C++23 and as a Defect Report, affecting C++11 and greater. After implementing this paper in Clang, we observed the proposed changes make ill-formed previously valid and relied upon code.

identifiers refered to captured variables but do not take the mutable keyword into account

struct F {
float x;
void mem1(decltype((x)) p3); // p3 is a float&
void mem2(decltype((x)) p4) const; // p4 is a float&
};
int x;
[x=42.0]<decltype(x) a> // float
(decltype((x)) b) // float&
-> decltype((x)) // const float&
tags: CWG, straw-poll, C++23, plenary-approved

P2582 Wording for class template argument deduction from inherited constructors (Timur Doumler)

This paper provides wording for class template argument deduction from inherited constructors.

From P1021R6

Before:

template<class T>
struct Point { T x; T y; };

// Aggregate: Cannot deduce
Point<double> p{3.0, 4.0};
Point<double> p2{.x = 3.0, .y = 4.0};

After:

template<class T>
struct Point { T x; T y; };

// Proposed: Aggregates deduce
Point p{3.0, 4.0};
Point p2{.x = 3.0, .y = 4.0};
tags: CWG, straw-poll, C++23, plenary-approved

P2585 Improving default container formatting (Barry Revzin)

[P2286R8] adds support for formatting any range whose underlying type is formattable. Additionally, it adds support for different kinds of formatting that users can opt into, while also providing a default choice for associating containers that is more suited to what those containers represent.

However, this distinction is a result of [P2286R8] explicitly providing formatters for all the standard library map and set containers, and applying those changes to them. This is something that users can do for their own containers as well, but which also means that it is something users have to do - if this is the behavior they want.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, lwg-fullreview, B2 - improvement, size - medium, plenary-approved

P2588 Relax std::barrier phase completion step guarantees (Gonzalo Brito Gadeschi, Eric Niebler, Anthony Williams, Thomas Rodgers)

Unintended consequences of std::barrier ’s specification constrain implementations to run the CompletionFunction on the last thread that arrives at the barrier during the phase. This prevents std::barrier from benefiting from hardware acceleration for thread synchronization. Removing these constraints is a breaking change. This paper aims to find a sweet spot for the barrier specification that delivers the functionality that applications need while allowing efficient implementations.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved

P2590 Explicit lifetime management (Timur Doumler, Richard Smith)

This paper proposes a new standard library facility std::start_lifetime_as. For objects of sufficiently trivial types, this facility can be used to efficiently create objects and start their lifetime to give programs defined behaviour, without running any constructor code. This proposal completes the functionality proposed in [P0593R6] and adopted for C++20 by providing the standard library portion of that paper (only the core language portion of that paper made it into C++20).

tags: CWG, LWG, C++23, tentatively-ready-for-plenary, lwg-fullreview, plenary-approved

P2599 mdspan::size_type should be index_type (Nevin Liber)

With the adoption of P2553R1, mdspan::size_type may now be a signed type. size_type is no longer an appropriate name for this type and it should be changed to index_type.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, mdspan

P2602 Poison Pills are Too Toxic (Barry Revzin)

Given the following declarations:

struct A {
    friend auto begin(A const&) -> int const*;
    friend auto end(A const&)   -> int const*;
};

struct B {
    friend auto begin(B&) -> int*;
    friend auto end(B&) -> int*;
};

B and const A satisfy std::ranges::range, but A does not. The goal of this paper is that both of these should count as ranges.

tags: LWG, ranges, C++23, IS, B2 - improvement, size - small, plenary-approved

P2604 mdspan: rename pointer and contiguous (Christian Trott)

During LWG review a few members of classes in the mdspan proposals were identified as problematic, this paper proposes renaming those members.

pointer to data_handle_type

data() to data_handle()

contiguous to exhaustive

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, mdspan

P2609 Relaxing Ranges Just A Smidge (John Eivind Helset)

Ranges algorithms that take a function and a projection should, in the unary case, constrain the function to enable:

iter_value_t<It> x = *it;
f(proj(x));

Instead they are constrained to allow:

iter_value_t<projected<I,Proj>> u = proj(*it);
f(u);

And likewise in the binary case. This is caused by the composition of indirect callable concepts with projected, seen for example in the constraints of ranges::for_each as indirect_unary_invocable<projected<I,P>>.

A fix is proposed that introduces a type-trait and makes a slight change to the definitions of the indirect callable concepts, as well as iter_common_reference_t. The fix is a slight relaxation of the algorithmic constraints in ranges that does not break ABI.

tags: LWG, ranges, C++23, IS, B2 - improvement, size - small, plenary-approved

P2613 Add the missing empty to mdspan (Yihe Le)

This paper propose to fix a defect in [P0009R17]. During its LWG review, I found that even though the proposed std::mdspan type have a size() member function, it does not have an empty() member function, which makes it distinct from nearly all other STL containers. So this paper propose to add the missing member to increase consistency and performance of common operations.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, plenary-approved, mdspan

P2614 Deprecate numeric_limits::has_denorm (Matthias Kretz)

Since C is intent on obsoleting the *_HAS_SUBNORM macros, we should consider the analogue change in C++: the deprecation of numeric_limits::has_denorm. In general, compile-time constants that describe floating-point behavior are problematic, since behavior might change at runtime. Let’s also deprecate numeric_limits::has_denorm_loss while we’re at it.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved

P2644 Get Fix of Broken Range-based for Loop Finally Done (Nicolai Josuttis)

This paper summarizes the fix for the still open issues cwg900, cwg1498, ewg120. The issue is a bug that is 13 years old now, applies to one of the most important control structures of Modern C++, and leads to confusion and ill-formed programs due to unexpected undefined behavior and effort for teaching and training.

BeforeAfter
for (auto e : getTmp().getRef())BROKENOK
for (auto e : getVector()[0])BROKENOK
for (auto valueElem : getMap()["key"])BROKENOK
for (auto e : get<0>(getTuple()))BROKENOK
for (auto e : getOptionalColl().value())BROKENOK
for (char c : get<string>(getVariant()))BROKENOK
for (auto s : std::span{arrOfConst()}.last(2))BROKENOK
for (auto e : std::span(getVector().data(), 2))BROKENOK
for (auto e: co_await coroReturningRef())BROKENOK
// assume getValue() returns value by reference:
for (char c : getData().value)OKOK
for (char c : getData().getValue())BROKENOK
tags: CWG, C++23, plenary-approved

P2652 Disallow user specialization of allocator_traits (Pablo Halpern)

The allocator_traits class template was introduced in C++11 with two goals in mind:

  1. Provide default implementations for allocator types and operations, thus minimizing the requirements on allocators [allocator.requirements], and
  2. provide a mechanism by which future standards could extend the allocator interface without changing allocator requirements and thus obsoleting existing allocators.

The latter goal is undermined, however, by the standard currently allowing user-defined specializations of std::allocator_traits. Although the standard requires that any such specialization conform to the standard interface, it is not practical to change the standard interface – even by extending it – without breaking any existing user specializations. Indeed, the Sep 2022 C++23 CD, N4919 contains an extension, allocate_at_least, that logically belongs in std:::allocator_traits, but is expressed as an unrelated function because of the problem of potential user-defined specializations.

This paper proposes that the standard remove the user’s latitude for specializing std::allocator_traits.

This paper is the proposed resolution to a US NB comment having the same title; it is targeted for C++23.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved

P2655 common_reference_t of reference_wrapper Should Be a Reference Type (Hui Xie, S. Levent Yilmaz)

This paper proposes a fix that makes the common_reference_t<T&,reference_wrapper<T>> a reference type T&.

Before

static_assert(same_as<
              common_reference_t<int&, reference_wrapper<int>>,
              int>);

static_assert(same_as<
              common_reference_t<int&, reference_wrapper<int>&>,
              int>);

static_assert(same_as<
              common_reference_t<int&, const reference_wrapper<int>&>,
              const int&>);

After

static_assert(same_as<
              common_reference_t<int&, reference_wrapper<int>>,
              int&>);

static_assert(same_as<
              common_reference_t<int&, reference_wrapper<int>&>,
              int&>);

static_assert(same_as<
              common_reference_t<int&, const reference_wrapper<int>&>,
              int&>);
tags: LWG, C++23, IS, B2 - improvement, size - small, plenary-approved

P2674 A trait for implicit lifetime types (Timur Doumler, Vittorio Romeo)

C++20 introduced the notion of implicit-lifetime types. There are certain operations that are only valid for such types. We therefore need a way to check whether a type is implicit-lifetime, and constrain on this property. This paper proposes a new type trait std::is_implicit_lifetime to achieve this.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B3 - addition, size - small, plenary-approved

P2675 LWG3780: The Paper

format’s width estimation is too approximate and not forward compatible

LWG3780 describes an issue with width in std::format estimation. This paper offers more information

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved, format

P2679 Fixing std::start_lifetime_as for arrays (Timur Doumler, Arthur O’Dwyer, Richard Smith)

std::start_lifetime_as and std::start_lifetime_as_array, facilities to explicitly start the lifetime of an object of implicit-lifetime type inside a block of suitably aligned storage, was introduced in [P2590R2] and voted into C++23. We propose to fix some remaining issues before C++23 ships. We also discuss possible changes to the API that were considered but rejected.

tags: CWG, LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved

P2693 Formatting thread::id and stacktrace (Corentin Jabot, Victor Zverovich)

This paper provides wording in reply to NB comments suggesting to adopt P1636R2 (Formatters for library types) and to add formatters for std::stacktrace.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - medium, plenary-approved, format

P2711 Ruminations on explicit multi-param constructors of views (Ville Voutilainen)

This paper is about LWG 3714, Non-single-argument constructors for range adaptors should not be explicit.

We have C++20 views, none of which have explicit multi-param constructors, and some newer C++23 views which do. This is an obscure and rarely-noticeable difference. This paper looks at some aspects of it.

tags: LWG, ranges, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - medium, plenary-approved

P2713 Escaping improvements in std::format (Victor Zverovich)

This paper provides wording for the resolution of national body comments [US38-098] and [FR005-134] per direction voted in SG16 Unicode and LEWG.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size -small, plenary-approved, format

P2736 Referencing the Unicode Standard (Corentin Jabot)

We propose to reference The Unicode Standard instead of ISO 10646. This proposal has no impact on implementations. This resolves NB comments FR-010-133 and FR-021-013

tags: CWG, LWG, C++23, nb-comment, plenary-approved

P2763 layout_stride static extents default constructor fix (Christian Trott, Damien Lebrun-Gran…

During work on the padded layouts project an oversight in the layout_stride definition was discovered for a corner case. Specifically, the default constructor of a layout_stride with fully static extents will produce an invalid mapping.

tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size-small, plenary-approved, mdspan

P2770 Stashing stashing iterators for proper flattening (Tim Song)

This paper provides wording to resolve [LWG3698], [LWG3700], [LWG3791], and NB comment US 61-126.

tags: LWG, C++23, plenary-approved

P2787 pmr::generator - Promise Types are not Values (Steve Downey)

The type returned from a coroutine is not a value semantic container. It nonetheless can satisfy the requirements for supporting pmr generators. It is useful to provide a pmr alias to make the requirement to use pmr allocators visible in the typesystem

Before

std::pmr::monotonic_buffer_resource                          mbr;
std::pmr::polymorphic_allocator<>                            pa{&mbr};
std::generator<int, void, std::pmr::polymorphic_allocator<>> g =
    pmr_requiring_coroutine(std::allocator_arg, pa);

After

std::pmr::monotonic_buffer_resource mbr;
std::pmr::polymorphic_allocator<>   pa{&mbr};

std::pmr::generator<int> g = pmr_requiring_coroutine(std::allocator_arg, pa);
tags: LWG, C++23, tentatively-ready-for-plenary, IS, B2 - improvement, size - small, plenary-approved

P2788 Linkage for modular constants (S. Davis Herring)

National body comment US 8-036 points out an unfortunate interaction between C++98 linkage rules and C++20 modules. This paper explains the interaction in more detail, motivates a choice among the suggestions offered by the comment, and provides wording for that choice.

P2789 C++ Standard Library Ready Issues to be moved in Issaquah, Feb. 2023 (Jonathan Wakely)

tags: LWG, info, C++23, plenary-approved

P2790 C++ Standard Library Immediate Issues to be moved in Issaquah, Feb. 2023 (Jonathan Wakely)

tags: LWG, info, C++23, plenary-approved

P2796 Core Language Working Group “ready” Issues for the February, 2023 meeting (Jens Maurer)

tags: CWG, C++23, plenary-approved

P2797 Proposed resolution for CWG2692 Static and explicit object member functions with the same parameter-type-lists (Gašper Ažman, Barry Revzin)

This document proposes a resolution to [CWG2692]. This also touches the proposed resolution to [CWG2687].

tags: CWG, C++23, plenary-approved

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published