C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Only reason I don't use std::array

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 17 Aug 2023 21:21:03 +0100
On Thu, Aug 17, 2023 at 9:08 PM Lénárd Szolnoki wrote:
>
> foo(a, pretend_is_std_array(a.arr)); // breaking the aliasing
> assumption here


I'll get to the point here:

How about we explicitly write in the C++26 Standard that T[len] and
array<T,len> are ABI-compatible, and also provide two functions:

    stdarray_to_array
    array_to_stdarray

, both of which return a reference to an object that doesn't
malfunction where you have anti-aliasing optimisations.

Received on 2023-08-17 20:21:13