C++ Logo


Advanced search

Re: Proposal: template function solution to Pythonic optional function arguments

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 20 Jul 2020 23:52:51 +0300
On Mon, 20 Jul 2020 at 23:43, Jason McKesson via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> > Straight-up named parameter calling (not looking for any variadic nonsense à la *args/**kwargs)
> That right there is kind of a problem: if you can't forward named
> parameters to another function, then you break a lot of very useful
> use cases. You can't `emplace`-construct any object with named
> parameters, for example.
> I would consider that a non-starter for such a feature.

There's a very easy way to avoid that problem: keyword parameters need
to be last and arguments for them
can be provided positionally, without a name. Then you can forward
them just fine.

Received on 2020-07-20 15:56:21