Skip to content

Commit 3c9eb61

Browse files
committed
Updates from Overleaf
1 parent c23e36d commit 3c9eb61

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

chapters/90_theory.tex

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,21 @@ \section{Argument-dependent lookup (ADL)}
99
\begin{box-note}
1010
\footnotesize Example of unqualified lookup. Both calls to \cpp{some_call} will resolve to \cpp{::A::B::some_call} since this is the first instance discovered by the compiler.
1111
\tcblower
12-
\cppfile{code_examples/theory/adl_unqualified.h}
12+
\cppfile{code_examples/theory/adl_unqalified_code.h}
13+
\end{box-note}
14+
15+
Due to the simplicity of unqualified lookup, we need an additional mechanism to discover overloads. Notably, it is a requirement for operator overloading since operator calls are unqualified. This is where argument-dependent lookup comes in.
16+
17+
\begin{box-note}
18+
\footnotesize Without ADL, any call to a custom operator overload would have to be fully qualified, requiring the function call syntax.
19+
\tcblower
20+
\cppfile{code_examples/theory/adl_code.h}
21+
\end{box-note}
22+
23+
While the full rules for ADL are long, the heavily simplified version is that the compiler will also consider the innermost namespace of all the arguments when determining the viable function overloads.
24+
25+
\begin{box-note}
26+
\footnotesize
27+
\tcblower
28+
\cppfile{code_examples/theory/adl_code.h}
1329
\end{box-note}

0 commit comments

Comments
 (0)