C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Initializing std::function with overload sets

From: Jan Schultke <janschultke_at_[hidden]>
Date: Thu, 27 Feb 2025 12:01:50 +0100
> std::function<double(double, double)> func1{nontype<add>};

How is this disambiguating? nontype still doesn't know which overload
to pick here, presumably since you're effectively doing:

> auto x = overload_set; // ill-formed

What Jack is proposing seems like pretty much the only way to fix
this, but I'm also not a fan of the fact that it requires an exact
match in terms of function signature. Creating std::function from
overloaded functions is rare enough; maybe it's not worth dealing with
the problem until we have better core language support (maybe declcall
and some other features could help here?).

Received on 2025-02-27 11:02:04