From 18e97af97e81d8cf7d0df775fe142c43e4e10e40 Mon Sep 17 00:00:00 2001
From: jediaz <jerome.diaz@inria.fr>
Date: Fri, 22 Mar 2024 11:19:14 +0100
Subject: [PATCH] Apply review corrections.

---
 1-ProceduralProgramming/4-Functions.ipynb          |  2 +-
 2-ObjectProgramming/3b-hands-on.ipynb              |  2 +-
 4-Templates/1-Intro.ipynb                          |  2 +-
 5-UsefulConceptsAndSTL/5-MoveSemantics.ipynb       |  2 +-
 .../2-ObjectProgramming/Solution/exercise13.cpp    | 14 +++++++-------
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/1-ProceduralProgramming/4-Functions.ipynb b/1-ProceduralProgramming/4-Functions.ipynb
index 69a9c37..3cd54af 100644
--- a/1-ProceduralProgramming/4-Functions.ipynb
+++ b/1-ProceduralProgramming/4-Functions.ipynb
@@ -57,7 +57,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "Due to the use of notebooks we will not need to seperate clearly function declaration from its definition, but we will revisit this [much later](../6-InRealEnvironment/2-FileStructure.ipynb) when we will see how a real project is written with different files involved."
+    "Due to the use of notebooks we will not need to separate clearly function declaration from its definition, but we will revisit this [much later](../6-InRealEnvironment/2-FileStructure.ipynb) when we will see how a real project is written with different files involved."
    ]
   },
   {
diff --git a/2-ObjectProgramming/3b-hands-on.ipynb b/2-ObjectProgramming/3b-hands-on.ipynb
index b420189..54f4d10 100644
--- a/2-ObjectProgramming/3b-hands-on.ipynb
+++ b/2-ObjectProgramming/3b-hands-on.ipynb
@@ -13,7 +13,7 @@
    "source": [
     "### **EXERCISE 15: change interface of `PowerOfTwoApprox` struct**\n",
     "\n",
-    "* Transform `Compute()` into a constructor. As a constructor cannot return a value (it returns an object!), introduce a method `AsDouble()` which returns the approximation (that by definition may be computed from data attributes `numerator_` and `exponent_`).\n",
+    "* Transform `Compute()` into a constructor. As a constructor cannot return a value, introduce a method `AsDouble()` which returns the approximation (that by definition may be computed from data attributes `numerator_` and `exponent_`).\n",
     "* Assign a default value of `0` to data attributes (if not already done previously!)\n",
     "\n",
     "Expected output is the same as previously.\n",
diff --git a/4-Templates/1-Intro.ipynb b/4-Templates/1-Intro.ipynb
index 7cb0473..8218cad 100644
--- a/4-Templates/1-Intro.ipynb
+++ b/4-Templates/1-Intro.ipynb
@@ -655,7 +655,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "Since C++17, there are exactly zero differences between both keywords; some authors suggest conventions (e.g. use `typename` for POD types and `class` for the more complicated types) but they are just that: conventions!\n",
+    "Since C++ 17, there are exactly zero differences between both keywords (before C++ 17, they were almost everywhere equivalent except in a very specific case - called template template parameter that we'll see shortly - in which typename did not work. You can check [this link](https://stackoverflow.com/questions/2023977/what-is-the-difference-between-typename-and-class-template-parameters) if you want to know more); some authors suggest conventions (e.g. use `typename` for POD types and `class` for the more complicated types) but they are just that: conventions!\n",
     "\n",
     "* The definition of the templates must be provided in header files, not in compiled files. The reason is that the compiler can't know all the types for which the template might be used: you may use `std::min` for your own defined types (provided they define a `<` operator...) and obviously STL writers can't foresee which type you will come up with!\n",
     "* The compiler will generate the code for each type given to the template; for instance if `Convert<double>`, `Convert<unsigned int>` and `Convert<short>` are used in your code, the content of this template function will be instantiated thrice! This can lead to **code bloat**: lots of assembler code is generated, and compilation time may increase significatively. \n",
diff --git a/5-UsefulConceptsAndSTL/5-MoveSemantics.ipynb b/5-UsefulConceptsAndSTL/5-MoveSemantics.ipynb
index 22d69f7..f09db6e 100644
--- a/5-UsefulConceptsAndSTL/5-MoveSemantics.ipynb
+++ b/5-UsefulConceptsAndSTL/5-MoveSemantics.ipynb
@@ -901,7 +901,7 @@
    "source": [
     "## Forwarding reference (or universal reference)\n",
     "\n",
-    "Just a quick warning (you should really read [Effective modern C++](../bibliography.ipynb#Effective-Modern-C++) for an extensive discussion on the topic; blog [FluentCpp](https://www.fluentcpp.com/2018/02/06/understanding-lvalues-rvalues-and-their-references) provides some intel about it... and tells you as well to really Scott Meyer's book to learn more!): seeing `&&` doesn't automatically mean it is a r-value reference.\n",
+    "Just a quick warning (you should really read [Effective modern C++](../bibliography.ipynb#Effective-Modern-C++) for an extensive discussion on the topic; blog [FluentCpp](https://www.fluentcpp.com/2018/02/06/understanding-lvalues-rvalues-and-their-references) provides some intel about it... and tells you as well to read Scott Meyer's book to learn more!): seeing `&&` doesn't automatically mean it is a r-value reference.\n",
     "\n",
     "There is a very specific case when:\n",
     "- The argument is template \n",
diff --git a/HandsOn/2-ObjectProgramming/Solution/exercise13.cpp b/HandsOn/2-ObjectProgramming/Solution/exercise13.cpp
index f2e113f..53bb7ed 100644
--- a/HandsOn/2-ObjectProgramming/Solution/exercise13.cpp
+++ b/HandsOn/2-ObjectProgramming/Solution/exercise13.cpp
@@ -11,8 +11,8 @@
 struct PowerOfTwoApprox
 {
 
-    int numerator_ {};
-    int exponent_ {};
+    int numerator {};
+    int exponent {};
 
 };
 
@@ -102,8 +102,8 @@ void DisplayPowerOf2Approx(int Nbits, double value)
         
     const double error = std::fabs(value - double_quotient) / value;
         
-    std::cout << "[With " << Nbits << " bits]: " << value << " ~ " << double_quotient << " (" << approximation.numerator_ << 
-        " / 2^" << approximation.exponent_ << ")  [error = " << RoundAsInt(100. * error) << "/100]" << std::endl;
+    std::cout << "[With " << Nbits << " bits]: " << value << " ~ " << double_quotient << " (" << approximation.numerator << 
+        " / 2^" << approximation.exponent << ")  [error = " << RoundAsInt(100. * error) << "/100]" << std::endl;
 }
 
 
@@ -117,8 +117,8 @@ double ComputePowerOf2Approx(int Nbits, double value, PowerOfTwoApprox& approxim
 {
     int max_numerator = MaxInt(Nbits);
     
-    auto& numerator = approximation.numerator_; // alias!
-    auto& exponent = approximation.exponent_; // alias!
+    auto& numerator = approximation.numerator; // alias!
+    auto& exponent = approximation.exponent; // alias!
 
     int denominator {};
     
@@ -144,7 +144,7 @@ int Multiply(int Nbits, double value, int coefficient)
 
     ComputePowerOf2Approx(Nbits, value, approximation);
 
-    return TimesPowerOf2(approximation.numerator_ * coefficient, -approximation.exponent_);
+    return TimesPowerOf2(approximation.numerator * coefficient, -approximation.exponent);
 }
 
 
-- 
GitLab