Youtube - Back to Basics - Name Lookup and Overload Resolution in C++ - Mateusz Pusz - CppCon 2022
Back to Basics - Name Lookup and Overload Resolution in C++ - Mateusz Pusz - CppCon 2022
Transcription
https://www.youtube.com/watch?v=iDX2d7poJnI&feature=youtu.be
01:49




03:02

05:16

Unqualified name lookup
14:36
- [#] Unqualified name lookup examines the scopes, until it finds at least one declaration of any kind (does not have to be a function) with a matching name, at which time scopes traversing stops and no further scopes are examined.

Mas, se comentar func(int) compila normalmente


17:21

PROBLEMA

unqualified name search in other scope too
20:12

Argument-Dependent Lookup (ADL) or Konig lookup
#doubt Argument-Dependent Lookup (ADL) or Konig lookup
20:25

- [#] Argument-Dependent Lookup (ADL) or Konig lookup is a set of rules for the lookup of unqualified function names. The algorithm tells the compiler to not just look at local scope, but also the namespaces that contain the argument's type. Unqualified function names are additionally looked up in the namespace of their arguments.
using expande antes da Argument-Dependent Lookup (ADL) or Konig lookup

hidden friend - friend nĂŁo faz parte oficialmente do namespace N2


26:33


28:03

29:40

30:35

30:41

32:02


33:47

35:09

![[cpp_patterns#Generic frameworks with customization points]]
35:14

37:34


41:38

42:11
#best-practices usar std::range::swap ao invés de std::swap
44:15

45:33

53:36

#error-prone #best-practices Avoid functions templates specializations. When occurs overload resolution, the compiler select at first the best-matching in this order: (1) non-template, (2) primary function template, only after that, (3) specialization function template (even though specialization would be itself a perfect match! ). Specializations function templpate are not overloaded.
#recommended assistir este vĂdeo
