#
Define
[over.best.ics] defines the implicit conversion sequences and [over.ics.rank] defines what it means for one implicit conversion sequence to be a better conversion sequence or worse conversion sequence than another.
2
#
Given these definitions, a viable function
If there is exactly one viable function that is a better function than all other viable functions, then it is the one selected by overload resolution; otherwise the call is ill-formed.100
[Example 8: void Fcn(const int*, short); void Fcn(int*, int); int i; short s = 0; void f() { Fcn(&i, s); / is ambiguous because &i int* is better than &i const int* / but s short is also better than s int Fcn(&i, 1L); / calls Fcn(int*, int), because &i int* is better than &i const int* / and 1L short and 1L int are indistinguishable Fcn(&i, 'c'); / calls Fcn(int*, int), because &i int* is better than &i const int* / and 'c' int is better than 'c' short } — end example]
[Note 1: 
If the best viable function was made viable by one or more default arguments, additional requirements apply ([over.match.viable]).
— end note]
100)100)
The algorithm for selecting the best viable function is linear in the number of viable functions.
Run a simple tournament to find a function W that is not worse than any opponent it faced.
Although it is possible that another function F that W did not face is at least as good as W, F cannot be the best function because at some point in the tournament F encountered another function G such that F was not better than G.
Hence, either W is the best function or there is no best function.
So, make a second pass over the viable functions to verify that W is better than all other functions.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant