C++ Logo

std-proposals

Advanced search

Re: Adding piecewise_construct - constructor to std::tuple

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Thu, 12 Nov 2020 18:31:39 +0100
Why does it need to be multiple arbitrary template packs?
It could be to use one pack that accepts arbitrary types but
restricted to tuples?

Something like:
```
template<typename... T>
   require (is_tuple<T> && ...)
void f(T... t)
{
}
```


czw., 12 lis 2020 o 16:13 Jason McKesson via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
> Piecewise in-place construction of a pair is already incredibly
> cumbersome to write and read for just two values. Expanding that to N
> values is going to make for some pretty nightmarish code.
>
> Also, I'm not sure it's actually possible to extend it to N tuples.
> `pair`'s piecewise-construction constructor is hard-coded to have 2
> template packs in it. An N-tuple version would need to have N packs.
> You can write that for any particular N, but I don't know if it's
> possible for a generalized arbitrary N.
>
> So before going down the road of a proposal, you should write an
> implementation of it.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2020-11-12 11:31:53