File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 3030 \begin {block }{Specificities of reference}
3131 \begin {itemize }
3232 \item Natural syntax
33- \item Must be assigned when defined, cannot be \mintinline {cpp}{nullptr}
34- \item Cannot be reassigned
35- \item Non-const references to temporary objects are not allowed
33+ \item Cannot be \mintinline {cpp}{nullptr}
34+ \item Must be assigned when defined, cannot be reassigned
35+ \item References to temporary objects must be \mintinline {cpp}{const}
3636 \end {itemize }
3737 \end {block }
3838 \begin {block }{Advantages of pointers}
3939 \begin {itemize }
40- \item Can be reassigned to point elsewhere or to \mintinline {cpp}{nullptr}
41- \item Clearly indicates that argument may be modified
40+ \item Can be \mintinline {cpp}{nullptr}
41+ \item Can be initialized after declaration, can be reassigned
4242 \end {itemize }
4343 \end {block }
4444 \pause
4545 \begin {goodpractice }{References}
4646 \begin {itemize }
47- \item Always use references when you can
48- \item Consider that a referenced object can be modified
49- \item Use \mintinline {cpp}{const} when it's not the case
47+ \item Prefer using references instead of pointers
48+ \item Mark references \mintinline {cpp}{const} to prevent modification
5049 \end {itemize }
5150 \end {goodpractice }
5251\end {frame }
You can’t perform that action at this time.
0 commit comments