This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

44
cppdraft/over/pre.md Normal file
View File

@@ -0,0 +1,44 @@
[over.pre]
# 12 Overloading [[over]](./#over)
## 12.1 Preamble [over.pre]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L9)
[*Note [1](#note-1)*:
Each of two or more entities with the same name in the same scope,
which must be functions or function templates,
is commonly called an “overload”[.](#1.sentence-1)
— *end note*]
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L18)
When a function is designated in a call, which function
declaration is being referenced and the validity of the call
are determined by comparing the types
of the arguments at the point of use with the types of the parameters
in the declarations in the overload set[.](#2.sentence-1)
This function selection process is called[*overload resolution*](#def:overload_resolution "12.1Preamble[over.pre]") and is defined in [[over.match]](over.match "12.2Overload resolution")[.](#2.sentence-2)
[*Note [2](#note-2)*:
Overload sets are formed by [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]")*s* naming functions and function templates and
by [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]")*s* designating entities of the same kinds[.](#2.sentence-3)
— *end note*]
[*Example [1](#example-1)*:
[🔗](#:overloading,example_of)
double abs(double);int abs(int);
abs(1); // calls abs(int); abs(1.0); // calls abs(double); — *end example*]