diff --git a/4-Templates/1-Intro.ipynb b/4-Templates/1-Intro.ipynb index 6fe8922b310081d19f1e48753b99469723dcb2f0..5d1990606ac42fc60be661831dcc54db1c073d23 100644 --- a/4-Templates/1-Intro.ipynb +++ b/4-Templates/1-Intro.ipynb @@ -298,10 +298,10 @@ "#include <string>\n", "\n", "{\n", - " HoldAValue integer(5);\n", + " HoldAValue integer {5};\n", " std::cout << \"Integer hold: \" << integer.GetValue() << std::endl;\n", "\n", - " HoldAValue<std::string> string(\"Hello world!\"); // If type not specified explicitly it would have been char*...\n", + " HoldAValue<std::string> string {\"Hello world!\"}; // If type not specified explicitly it would have been char*...\n", " std::cout << \"String hold: \" << string.GetValue() << std::endl;\n", "}" ] @@ -312,6 +312,8 @@ "source": [ "The template must be reminded in the definition as well; please notice before the `::` the brackets with the template parameters.\n", "\n", + "Spot the template type is not defined for the `integer` variable. The type is automatically deduced from the `5` argument value as an `int`. This variable could have been defined as `HoldAValue<int> integer {5};` (cf. [types deduction](../1-ProceduralProgramming/3-Types.ipynb#decltype-and-auto))\n", + "\n", "### Template method of a template class\n", "\n", "Notice a template class may provide template methods:\n",