[HN Gopher] A Type for Overload Set
___________________________________________________________________
A Type for Overload Set
Author : aw1621107
Score : 11 points
Date : 2024-07-03 05:22 UTC (1 days ago)
(HTM) web link (biowpn.github.io)
(TXT) w3m dump (biowpn.github.io)
| mmaniac wrote:
| > The crux of the problem, where all the examples above share in
| common, is that C++ does not have a type for overload sets.
|
| >There is a recent proposal that aims to address this exact
| issue: P3312 - Overload Set Types.
|
| Painfully common story.
| captainmuon wrote:
| I'm really surprised that the first example doesn't work. I would
| have thought that it decides which overload to use only when
| instantiating the template, and then doing argument dependent
| lookup (or whatever it is called) to pick the correct overload to
| match the type of the elements.
|
| On the other hand, I don't even know how transform is defined.
| C++ has nothing exactly like IEnumerable<T>, so maybe it is hard
| to refer to the T? And of course what the article references,
| that there is no way to refer to the overload set.
|
| I usually like C++, but it is not fun when the abstractions break
| like that.
| mmaniac wrote:
| The compiler doesn't have enough information yet to pick an
| overload when instantiating the transform template. transform
| takes any F as the function parameter, which isn't specific
| enough to pick a specific function pointer from an overload
| set.
___________________________________________________________________
(page generated 2024-07-04 23:01 UTC)