C++ Logo


Advanced search

Re: [std-proposals] C-style array specialization for std::get

From: Zhihao Yuan <zy_at_[hidden]>
Date: Mon, 18 Apr 2022 16:48:28 +0000
On Monday, April 18th, 2022 at 8:24 AM, Paolo Di Giglio <p.digiglio91_at_[hidden]> wrote:


> > I slightly prefer the constraining specification, so that you don't
> > need to thinking about the fate of volatile tuple_element.

> I believe you need to think about volatile in either case.

> The subtlety with C-style array types is that there's no difference
> between applying a cv-qualifier to the array or to the element type:
> i.e. a constant array of N integers is the same as an array of N
> constant integers. This is not the case with std::array.

> My understanding is that the standard will drop the tuple-protocol
> support for volatile-qualified std::array; not for std::array of
> volatile-qualified elements. I.e.

> //using namespace std;
> tuple_element_t<0, array<int, 42> volatile> // Won't compile
> tuple_element_t<0, array<int volatile, 42>> // Ok: int volatile

I'm not sure whether std::array supportsT volatile element type. It's very likelyarray<T volatile, N> doesn't meet theContainer requirements.
Regardless, this can be discussed inLEWG.

Received on 2022-04-18 16:48:38