Skip to content

Commit edfd493

Browse files
committed
Updates from Overleaf
1 parent 8c6fd0d commit edfd493

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

chapters/90_theory.tex

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
\chapter{In-depth}
1+
\chapter{Bits of C++ theory}
22

3-
In this chapter, we will go over relevant in-depth topics referenced throughout the rest of the book.
3+
This chapter will dive deep into the various topics referenced throughout the book. While this chapter serves as a reference, the topics are still presented in a heavily simplified, example-heavy format. For a proper reference, please refer to the C++ standard.
44

55
\section{Argument-dependent lookup (ADL)}
66

@@ -20,10 +20,25 @@ \section{Argument-dependent lookup (ADL)}
2020
\cppfile{code_examples/theory/adl_code.h}
2121
\end{box-note}
2222

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.
23+
While the full rules for ADL are quite complex, the heavily simplified version is that the compiler will also consider the innermost namespace of all the arguments when determining the viable function overloads.
2424

2525
\begin{box-note}
2626
\footnotesize
2727
\tcblower
28-
\cppfile{code_examples/theory/adl_code.h}
29-
\end{box-note}
28+
\cppfile{code_examples/theory/adl_simple_code.h}
29+
\end{box-note}
30+
31+
Arguably the true power of ADL lies in the interactions with other language features, so let's look at how ADL interacts with friend functions and function objects.
32+
33+
\subsection{Friend functions vs ADL}
34+
35+
Friend functions (when defined inline) do not participate in the normal lookup (they are part of the surrounding namespace but are not visible). However, they are still visible to ADL, which permits a common implementation pattern for a default implementation with a customization point through ADL.
36+
37+
\begin{box-note}
38+
\footnotesize Example demonstrating a default implementation with a customization point through ADL. The default implementation needs to be discovered during the unqualified lookup; therefore, if any custom implementation is visible in the surrounding namespaces, it will block this discovery.
39+
\tcblower
40+
\cppfile{code_examples/theory/adl_default_code.h}
41+
\end{box-note}
42+
43+
\subsection{Function objects vs ADL}
44+

0 commit comments

Comments
 (0)