Date: Thu, 17 Aug 2023 09:12:29 +0100
On Wed, Aug 16, 2023 at 11:08 PM Jason McKesson wrote:
>>
> > std::array arr = {
> > something1,
> > something2,
> > something3,
> > };
> >
> > also works.
>
> That deduction guide has been there since C++17, so it's standard.
> Assuming of course that all of those are of the same type.
I'm looking through cppreference.com here and I don't see a function
something like:
template< typename T, std::size_t len >
std::array<T,len> &pretend_is_std_array( T (&arg)[len] ); // returns
a reference
What are we supposed to do if we want to treat a C-style array as
though it's an std::array? Should we just reinterpret_cast?
>>
> > std::array arr = {
> > something1,
> > something2,
> > something3,
> > };
> >
> > also works.
>
> That deduction guide has been there since C++17, so it's standard.
> Assuming of course that all of those are of the same type.
I'm looking through cppreference.com here and I don't see a function
something like:
template< typename T, std::size_t len >
std::array<T,len> &pretend_is_std_array( T (&arg)[len] ); // returns
a reference
What are we supposed to do if we want to treat a C-style array as
though it's an std::array? Should we just reinterpret_cast?
Received on 2023-08-17 08:12:39