diff --git a/7-Appendix/0-main.ipynb b/7-Appendix/0-main.ipynb index 082a1760b33a7ff1e94799b8789406f9289f2f17..3aed15987870ec2ad14e1e6c615433c7caa9cc18 100644 --- a/7-Appendix/0-main.ipynb +++ b/7-Appendix/0-main.ipynb @@ -13,10 +13,10 @@ "source": [ "This appendix groups some stuff just mentioned in earlier tutorials but that I have chosen not to speak longly about because the lecture is already long enough as it is and they might be a tiny bit more complex for some of them.\n", "\n", - "* [Breaking circular definition of shared pointers with weak pointers](./WeakPtr.ipynb) explains how to set up properly a circular relationship shared/weak pointers (unfortunately the way to set it up properly is often coyly mentioned but not explained); this is a follow-up of the notebook about [smart pointers](../5-UsefulConceptsAndSTL/6-SmartPointers.ipynb).\n", - "\n", "* [CRTP](./Crtp.ipynb) is one of my favourite idiom to provide a same functionality to utterly different classes; it was teased in the [notebook](../4-Templates/5-MoreAdvanced.ipynb) about advanced features with templates.\n", "\n", + "* [Breaking circular definition of shared pointers with weak pointers](./WeakPtr.ipynb) explains how to set up properly a circular relationship shared/weak pointers (unfortunately the way to set it up properly is often coyly mentioned but not explained); this is a follow-up of the notebook about [smart pointers](../5-UsefulConceptsAndSTL/6-SmartPointers.ipynb). An existing CRTP from STL is used there at some point so you should probably consider reading it after the one explaining CRTP, but it is by no means a hard prerequisite.\n", + "\n", "* [Homemade exceptions](./HomemadeException.ipynb) just provides the instantiation of the class I personally use when I want to raise an exception; it's a direct follow-up of the section that [mentioned it](../5-UsefulConceptsAndSTL/1-ErrorHandling.ipynb#The-exception-class-I-use).\n", "\n", "* [Switch](./Switch.ipynb) is the less important one: it just explains `switch` statement and the syntax caveats you might encounter with them. It was mentioned in the [early notebook](../1-ProceduralProgramming/2-Conditions-and-loops.ipynb#switch-statement) about conditions.\n", diff --git a/7-Appendix/HomemadeException.ipynb b/7-Appendix/HomemadeException.ipynb index 0509f126deab0acea484be9f7a51f5ba574c7cb4..a5ddc92d352c1faff645771d3ff134c7a673f3d0 100644 --- a/7-Appendix/HomemadeException.ipynb +++ b/7-Appendix/HomemadeException.ipynb @@ -93,7 +93,7 @@ "\n", "### Indicating the file and line\n", "\n", - "If your code is huge, knowing the exception itself is not enough, if this exception may be thrown from several locations in your code. To identify where the exception was thrown, I use the `__FILE__` and `__LINE__` macro which gives the file and line where they were found in the code (better alternative [may appear](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html#reflection.src_loc) in C++ 20).\n", + "If your code is huge, knowing the exception itself is not enough, if this exception may be thrown from several locations in your code. To identify where the exception was thrown, I use the `__FILE__` and `__LINE__` macro which gives the file and line where they were found in the code (better alternative `std::source_location` is present in C++ 20 but is unfortunately [not well supported yet](https://en.cppreference.com/w/cpp/compiler_support)).\n", "\n", "So my constructor looks like:\n", "\n", @@ -348,5 +348,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/7-Appendix/StringView.ipynb b/7-Appendix/StringView.ipynb index d5cc5865c7dc61a8df7aa76eb1f30b0eeb2da5cc..1e0887b9c6747b9f0ce27ab512732d45e0fed247 100644 --- a/7-Appendix/StringView.ipynb +++ b/7-Appendix/StringView.ipynb @@ -29,7 +29,7 @@ "#include <string_view>\n", "#include <iostream>\n", "\n", - "void print(std::string_view content)\n", + "void Print(std::string_view content)\n", "{\n", " std::cout << \"Content is '\" << content << \"'\" << std::endl;\n", "}\n", @@ -37,9 +37,9 @@ "\n", "std::string hello(\"Hello world from std::string!\");\n", "\n", - "print(hello);\n", + "Print(hello);\n", "\n", - "print(\"Hello world!\");" + "Print(\"Hello world!\");" ] }, { @@ -60,7 +60,7 @@ "#include <string>\n", "#include <iostream>\n", "\n", - "void print_with_const_ref(const std::string& content)\n", + "void PrintWithConstRef(const std::string& content)\n", "{\n", " std::cout << \"Content is '\" << content << \"'\" << std::endl;\n", "}\n", @@ -68,8 +68,8 @@ "\n", "std::string hello(\"Hello world from std::string!\");\n", "\n", - "print_with_const_ref(hello);\n", - "print_with_const_ref(\"Hello world!\");" + "PrintWithConstRef(hello);\n", + "PrintWithConstRef(\"Hello world!\");" ] }, { @@ -100,12 +100,12 @@ "#include <string>\n", "#include <iostream>\n", "\n", - "void print_with_ref(std::string& content)\n", + "void PrintWithRef(std::string& content)\n", "{\n", " std::cout << \"Content is '\" << content << \"'\" << std::endl;\n", "}\n", "\n", - "print_with_ref(\"Hello world!\"); // COMPILATION ERROR!" + "PrintWithRef(\"Hello world!\"); // COMPILATION ERROR!" ] }, { @@ -159,7 +159,7 @@ "metadata": {}, "source": [ "\n", - "© _Inria 2021-2022_ \n", + "© _Inria 2021_ \n", "_This notebook is released under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ " ] } diff --git a/7-Appendix/Switch.ipynb b/7-Appendix/Switch.ipynb index 4b550a69ff07aacd8b6a55b69bdfe47a30d2b5fa..db7f3ee09a32b1b02f15699f7052b4ba17a5e51f 100644 --- a/7-Appendix/Switch.ipynb +++ b/7-Appendix/Switch.ipynb @@ -302,5 +302,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/7-Appendix/WeakPtr.ipynb b/7-Appendix/WeakPtr.ipynb index 99eea7d8f44de69abac9a2aeeb5a21934177fdd9..7056799957d9d64b957d47ff2e919b48cf5acef4 100644 --- a/7-Appendix/WeakPtr.ipynb +++ b/7-Appendix/WeakPtr.ipynb @@ -225,7 +225,7 @@ "\n", "It is only used for storage; you can't use the object underneath directly and have to build a `shared_ptr` from it before use with the method `lock()`. \n", "\n", - "There are just two modifications to do (used to be done here but circa 2021 Xeus emit a link so the code will be put instead [@Coliru](http://coliru.stacked-crooked.com/a/2013674aee9983d5):" + "There are just two modifications to do (used to be done here but circa 2021 Xeus emit a link so the code will be put instead [@Coliru](http://coliru.stacked-crooked.com/a/2013674aee9983d5)):" ] }, { @@ -314,7 +314,7 @@ "source": [ "This code causes an issue (which might be a crash or an error depending on your platform): the vector still includes `Yoda` as a child of `Darth Vader`, whereas the object no longer exists (we're once again in undefined behavior territory).\n", "\n", - "There is a method `expired()` that returns `true` if the underlying object no longer exists; but in fact lock gets a return value that may be used to the same purpose (see [@Coliru](http://coliru.stacked-crooked.com/a/fcdb5cf21897e4ef)):" + "There is a method `expired()` that returns `true` if the underlying object no longer exists; but in fact `lock()` gets a return value that may be used to the same purpose (see [@Coliru](http://coliru.stacked-crooked.com/a/fcdb5cf21897e4ef)):" ] }, { @@ -741,5 +741,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }