C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Allow operators to have a default std::source_location argument
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2020-03-07 17:24:58


On Fri, Mar 6, 2020 at 4:23 PM Joseph Malle via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> This proposal supersedes my previous one
> (https://lists.isocpp.org/std-proposals/2020/02/1018.php). Thanks to
> Arthur O'Dwyer for his comments in that thread and pointing me towards
> this simpler proposal.
> [...]
> This proposal is to allow a single default argument on any operator as
> long as it is a (possibly const and/or ref) std::source_location and
> defaults to std::source_location::current().
>

I was just looking through my old blog posts and realized there's another
edge case you should consider.
I don't know if it does cause problems, but it might.
https://quuxplusone.github.io/blog/2019/02/23/not-variadic-expression-templates/
<https://quuxplusone.github.io/blog/2019/02/23/not-variadic-expression-templates/>Operator
templates — specifically, variadic operator templates — can achieve roughly
the same effect as
    Foo operator*(int=0)
and you should think about whether that's relevant to this proposal. (Can
we today combine parameter packs with default function arguments? Might we
want to in the future?)

–Arthur



STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups