Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ashok Kumar, Bharath
so2021
Commits
8c4305c0
Commit
8c4305c0
authored
Feb 24, 2021
by
Praetorius, Simon
Browse files
fix minted bug with #
parent
65356abf
Changes
1
Hide whitespace changes
Inline
Side-by-side
lecture/03_operators.tex
View file @
8c4305c0
...
...
@@ -260,12 +260,12 @@ at all or not, \ie
\subsection
{
Operators as functions
}
In C++ nearly all operator can be written (and called) as a regular function. Let
\texttt
{
\#
}
be the symbol of the operator,
\eg
\texttt
{
\#
$
~
\in
$
\{
+,*,(),+=,<,...
\}
}
, then there zero, one or both of the following implementations are available:
In C++ nearly all operator can be written (and called) as a regular function. Let
\texttt
{
o
}
be the symbol of the operator,
\eg
\texttt
{
o
$
~
\in
$
\{
+,*,(),+=,<,...
\}
}
, then there zero, one or both of the following implementations are available:
\begin{minted}
[frame=none]
{
c++
}
Result operator
#
(Arg1 a, Arg2 b, ...) // a
#
b
Result Arg1::operator
#
(Arg2 b, ...) // Arg1 a; a
#
b
Result operator
o
(Arg1 a, Arg2 b, ...) // a
o
b
Result Arg1::operator
o
(Arg2 b, ...) // Arg1 a; a
o
b
\end{minted}
The variant 1 implement the operator as a free function, whereas the variant 2 implements the operator as a member function of a class,
where
\texttt
{
Arg1
}
is the name of that class. Whether there is a function representation of the operator and whether it is allowed to
\emph
{
overload
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment