Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 407fc24a authored by ROUVREAU Vincent's avatar ROUVREAU Vincent
Browse files

Clean all notebooks for CI to pass

parent 9292ecbc
No related branches found
No related tags found
1 merge request!98nbstripout on CI and docker build/push rework
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [Object programming](./0-main.ipynb)
%% Cell type:markdown id: tags:
* [Introduction to the concept of object](./1-Introduction.ipynb)
* [Hands-on 4](./1b-hands-on.ipynb)
* [Member functions](./2-Member-functions.ipynb)
* [Hands-on 5](./2b-hands-on.ipynb)
* [Base constructors and destructor](./3-constructors-destructor.ipynb)
* [Hands-on 6](./3b-hands-on.ipynb)
* [Encapsulation](./4-encapsulation.ipynb)
* [Hands-on 7](./4b-hands-on.ipynb)
* [Static attributes](./5-static.ipynb)
* [Inheritance](./6-inheritance.ipynb)
* [Polymorphism](./7-polymorphism.ipynb)
* [Hands-on 8](./7b-hands-on.ipynb)
%% Cell type:markdown id: tags:
[© Copyright](../COPYRIGHT.md)
......
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [Templates](./0-main.ipynb)
%% Cell type:markdown id: tags:
* [Introduction to the concept of templates](./1-Intro.ipynb)
* [Hands-on 12](./1b-hands-on.ipynb)
* [Specialization](./2-Specialization.ipynb)
* [Special syntax: typename, template and mandatory this](./3-Syntax.ipynb)
* [Hands-on 13](./3b-hands-on.ipynb)
* [Metaprogramming](./4-Metaprogramming.ipynb)
* [Hints to more advanced concepts with templates](./5-MoreAdvanced.ipynb)
%% Cell type:markdown id: tags:
[© Copyright](../COPYRIGHT.md)
......
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [Useful concepts and STL](./0-main.ipynb)
%% Cell type:markdown id: tags:
* [Error handling](./1-ErrorHandling.ipynb)
* [Hands-on 14](./1b-hands-on.ipynb)
* [RAII idiom](./2-RAII.ipynb)
* [Containers](./3-Containers.ipynb)
* [Hands-on 15](./3b-hands-on.ipynb)
* [Associative containers](./4-AssociativeContainers.ipynb)
* [Move semantics](./5-MoveSemantics.ipynb)
* [Smart pointers](./6-SmartPointers.ipynb)
* [Hands-on 16](./6b-hands-on.ipynb)
* [Algorithms](./7-Algorithms.ipynb)
%% Cell type:markdown id: tags:
[© Copyright](../COPYRIGHT.md)
......
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [Useful concepts and STL](/notebooks/5-UsefulConceptsAndSTL/0-main.ipynb) - [Hands-on 16](/notebooks/5-UsefulConceptsAndSTL/6b-hands-on.ipynb)
%% Cell type:markdown id: tags:
<h1>Table of contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#EXERCISE-40:-Use-a-shared-pointer-in-the-TestDisplayContainer::test_display_list_-container" data-toc-modified-id="EXERCISE-40:-Use-a-shared-pointer-in-the-TestDisplayContainer::test_display_list_-container-1">EXERCISE 40: Use a shared pointer in the <code>TestDisplayContainer::test_display_list_</code> container</a></span></li><li><span><a href="#EXERCISE-41:-Replace-shared_ptr-by-unique_ptr-for--TestDisplayContainer::test_display_list_" data-toc-modified-id="EXERCISE-41:-Replace-shared_ptr-by-unique_ptr-for--TestDisplayContainer::test_display_list_-2">EXERCISE 41: Replace <code>shared_ptr</code> by <code>unique_ptr</code> for <code>TestDisplayContainer::test_display_list_</code></a></span></li><li><span><a href="#EXERCISE-42:-remove-TestDisplayContainer-class" data-toc-modified-id="EXERCISE-42:-remove-TestDisplayContainer-class-3">EXERCISE 42: remove <code>TestDisplayContainer</code> class</a></span></li></ul></div>
%% Cell type:markdown id: tags:
### EXERCISE 40: Use a shared pointer in the `TestDisplayContainer::test_display_list_` container
`Register` and `main` function will of course have to be adapted accordingly.
%% Cell type:markdown id: tags:
### EXERCISE 41: Replace `shared_ptr` by `unique_ptr` for `TestDisplayContainer::test_display_list_`
`shared_ptr` was easier to introduce first due to its easier copy mechanism, but is actually unnecessary: `unique_ptr` may provide the same service with more efficiency.
Replace `shared_ptr` by `unique_ptr`; you will need to play a bit with move semantics for that.
To add a _rvalue_ to a `std::vector`, you should use `emplace_back()` method which does almost the same as `push_back()` but is more optimized for move semantics.
%% Cell type:markdown id: tags:
### EXERCISE 42: remove `TestDisplayContainer` class
If you look closely at your current `TestDisplayContainer`, you should realize it is nothing more than a thin wrapper over its internal `std::vector`. Remove the class entirely and replace it by a `std::vector<str::unique_ptr<TestDisplay>>` (you may if you wish create an alias to this type), that might even be named... `TestDisplayContainer`).
Consider optimizing `Loop()` function with new `for` syntax.
%% Cell type:markdown id: tags:
[© Copyright](../COPYRIGHT.md)
......
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [C++ in a real environment](./0-main.ipynb)
%% Cell type:markdown id: tags:
## Introduction: C++ is not an interpreted language!
We have used so far mostly (except for few snippets of code present in [Coliru](https://coliru.stacked-crooked.com/)) a very unusual flavor of C++: the interpreter cling, which makes C++ behaves rather like an interpreted language ~~(without some caveats: running twice the same cell with a function or class declaration or definition is not possible)~~ *no longer true in 2021!*.
The idea was to highlight first the language syntax and philosophy, and not add the pain of explaining the excruciating details of how to build it - which may not be exactly the same from one environment or another!
We won't do that in detail (CMake tool for instance would deserve its own dedicated lecture...) but give the hints required to understand how C++ is operated in more realistic settings than a Jupyter notebook.
* [Set up a minimal environment](./1-SetUpEnvironment.ipynb)
* [File structure of a C++ program](./2-FileStructure.ipynb)
* [Hands-on 17](./2b-hands-on.ipynb)
* [Compilers](./3-Compilers.ipynb)
* [Third-party libraries: how to include them without getting their compilation warnings](./4-ThirdParty.ipynb)
* [Namespaces](./5-Namespace.ipynb)
* [Tools](./6-Tools.ipynb)
%% Cell type:markdown id: tags:
[© Copyright](../COPYRIGHT.md)
......
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [Appendix](./0-main.ipynb)
%% Cell type:markdown id: tags:
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.
* [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.
* [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.
* [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).
* [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.
* [StringView](./StringView.ipynb) explains briefly the whereabouts of `std::string_view` which was introduced in C++ 17 - and which will be expanded to other types in C++ 20.
%% Cell type:markdown id: tags:
[© Copyright](../COPYRIGHT.md)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment