C++ Logo

std-proposals

Advanced search

Re: [std-proposals] comparison between pointers and bool

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 20 Apr 2026 16:46:36 +0300
On Mon, 20 Apr 2026 at 16:08, Muneem via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> A simpler way to fix this issue would be to simply allow "explicit" arguments just like how we make constructors explicit.

C++ already has something so close to explicit arguments that a
separate language facility is without merit:
https://godbolt.org/z/b8xv6EdPn

Pasted for convenience:

#include <concepts>

void f(std::same_as<int> auto x) {}

int main()
{
  f(42); // Ok
  //f(42.42); // Ill-formed
  f(static_cast<int>(42.42)); // Ok
}

Received on 2026-04-20 13:46:52