replace push_back with emplace_back and enable colorlinks

This commit is contained in:
Johannes Kapfhammer 2021-02-10 20:28:36 +01:00
parent 1cbaab8e46
commit d0f6df5d24
3 changed files with 21 additions and 22 deletions

BIN
book.pdf

Binary file not shown.

View File

@ -8,7 +8,7 @@
\usepackage[table]{xcolor} \usepackage[table]{xcolor}
\usepackage{tikz} \usepackage{tikz}
\usepackage{multicol} \usepackage{multicol}
\usepackage{hyperref} \usepackage[colorlinks=true]{hyperref}
\usepackage{array} \usepackage{array}
\usepackage{microtype} \usepackage{microtype}
@ -105,9 +105,8 @@
\include{chapter16} \include{chapter16}
%\include{chapter20} %\include{chapter20}
\chapter{State Graphs} \chapter{State Graphs}
Please watch the video about state graphs. Please watch the video about state graphs.\\
The video should be linked on the graph overview site, but please push Johannes \url{https://www.youtube.com/watch?v=RdK3b9QWs94}
to fix the link here too.
\part{Advanced topics} \part{Advanced topics}
\include{chapter15} \include{chapter15}

View File

@ -545,11 +545,11 @@ with weight $w$. For example, the graph
can be stored as follows: can be stored as follows:
\begin{lstlisting} \begin{lstlisting}
g.assign(4, {}); g.assign(4, {});
g[0].push_back({1,5}); g[0].emplace_back(1,5);
g[1].push_back({2,7}); g[1].emplace_back(2,7);
g[1].push_back({3,6}); g[1].emplace_back(3,6);
g[2].push_back({3,5}); g[2].emplace_back(3,5);
g[3].push_back({0,2}); g[3].emplace_back(0,2);
\end{lstlisting} \end{lstlisting}
The benefit of using adjacency lists is that The benefit of using adjacency lists is that
@ -723,11 +723,11 @@ Thus, the graph
\end{center} \end{center}
can be represented as follows: can be represented as follows:
\begin{lstlisting} \begin{lstlisting}
edges.push_back({0,2}); edges.emplace_back(0,2);
edges.push_back({1,3}); edges.emplace_back(1,3);
edges.push_back({1,4}); edges.emplace_back(1,4);
edges.push_back({2,4}); edges.emplace_back(2,4);
edges.push_back({3,1}); edges.emplace_back(3,1);
\end{lstlisting} \end{lstlisting}
\noindent \noindent
@ -756,14 +756,14 @@ For example, the graph
\end{tikzpicture} \end{tikzpicture}
\end{center} \end{center}
\begin{samepage} \begin{samepage}
can be represented as follows\footnote{In some older compilers, the function can be represented as follows\footnote{Instead of \texttt{emplace\_back(0,2,5)},
\texttt{make\_tuple} must be used instead of the braces (for example, one could also write \texttt{edges.push\_back(\{0,2,5\})} or
\texttt{make\_tuple(1,2,5)} instead of \texttt{\{1,2,5\}}).}: \texttt{edges.push\_back(make\_tuple(0,2,5))}, however, using \texttt{emplace\_back} is generally preferred.}:
\begin{lstlisting} \begin{lstlisting}
edges.push_back({0,2,5}); edges.emplace_back(0,2,5);
edges.push_back({1,3,7}); edges.emplace_back(1,3,7);
edges.push_back({1,4,6}); edges.emplace_back(1,4,6);
edges.push_back({2,4,5}); edges.emplace_back(2,4,5);
edges.push_back({3,1,2}); edges.emplace_back(3,1,2);
\end{lstlisting} \end{lstlisting}
\end{samepage} \end{samepage}