Commit 5ab0803b authored by CHAMONT David's avatar CHAMONT David
Browse files

Update Videos.

parent 907675e0
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
"\n", "\n",
"* One can customize what is the end of a range. instead of an *end iterator*, we will rather call this a *sentinel*. In a range-based for, the use of sentinels is allowed since C++17. \n", "* One can customize what is the end of a range. instead of an *end iterator*, we will rather call this a *sentinel*. In a range-based for, the use of sentinels is allowed since C++17. \n",
"* A **delimited range** has a fixed, but unknown, size. It can be the values of an `istream`. A predicate is used so to define the end of the range.\n", "* A **delimited range** has a fixed, but unknown, size. It can be the values of an `istream`. A predicate is used so to define the end of the range.\n",
"* An **infinite range** has noend. This may prive useful when you combine several collections with a `zip`." "* An **infinite range** has no end. This may prive useful when you combine several collections with a `zip`."
] ]
}, },
{ {
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
"* Visual C++ and Clang already support major portions, in the namespace `std::experimental`.\n", "* Visual C++ and Clang already support major portions, in the namespace `std::experimental`.\n",
"* GCC 10: coroutines isn't exposed with `-std=c++20`, but for now explicitly requires the `-fcoroutines -fno-exceptions` flags to be set.\n", "* GCC 10: coroutines isn't exposed with `-std=c++20`, but for now explicitly requires the `-fcoroutines -fno-exceptions` flags to be set.\n",
"* C++23 standard library should introduce turnkey elements such as `std::generator`.\n", "* C++23 standard library should introduce turnkey elements such as `std::generator`.\n",
"* Meanwhile, a welll known third-party library is [https://github.com/lewissbaker/cppcoro](cppcoro)." "* Meanwhile, a well known third-party library is [https://github.com/lewissbaker/cppcoro](cppcoro)."
] ]
}, },
{ {
......
...@@ -28,16 +28,16 @@ using Time = SiUnit<double,1,0> ; ...@@ -28,16 +28,16 @@ using Time = SiUnit<double,1,0> ;
constexpr Time operator ""_Se ( long double value ) constexpr Time operator ""_Se ( long double value )
{ return Time{static_cast<double>(value)} ; } { return Time{static_cast<double>(value)} ; }
constexpr Time operator ""_Mi ( long double value ) constexpr Time operator ""_Mi ( long double value )
{ return Time{static_cast<double>(value)*60} ; } { return Time{static_cast<double>(value*60)} ; }
constexpr Time operator ""_H ( long double value ) constexpr Time operator ""_H ( long double value )
{ return Time{static_cast<double>(value)*60*60} ; } { return Time{static_cast<double>(value*60*60)} ; }
constexpr Time operator ""_Se ( unsigned long long value ) constexpr Time operator ""_Se ( unsigned long long value )
{ return Time{static_cast<double>(value)} ; } { return Time{static_cast<double>(value)} ; }
constexpr Time operator ""_Mi ( unsigned long long value ) constexpr Time operator ""_Mi ( unsigned long long value )
{ return Time{static_cast<double>(value)*60} ; } { return Time{static_cast<double>(value*60)} ; }
constexpr Time operator ""_H ( unsigned long long value ) constexpr Time operator ""_H ( unsigned long long value )
{ return Time{static_cast<double>(value)*60*60} ; } { return Time{static_cast<double>(value*60*60)} ; }
constexpr Time Se { 1._Se } ; constexpr Time Se { 1._Se } ;
constexpr Time Mi { 1._Mi } ; constexpr Time Mi { 1._Mi } ;
...@@ -48,12 +48,12 @@ using Length = SiUnit<double,0,1> ; ...@@ -48,12 +48,12 @@ using Length = SiUnit<double,0,1> ;
constexpr Length operator ""_M ( long double value ) constexpr Length operator ""_M ( long double value )
{ return Length{static_cast<double>(value)} ; } { return Length{static_cast<double>(value)} ; }
constexpr Length operator ""_KM ( long double value ) constexpr Length operator ""_KM ( long double value )
{ return Length{static_cast<double>(value)*1000} ; } { return Length{static_cast<double>(value*1000l)} ; }
constexpr Length operator ""_M ( unsigned long long value ) constexpr Length operator ""_M ( unsigned long long value )
{ return Length{static_cast<double>(value)} ; } { return Length{static_cast<double>(value)} ; }
constexpr Length operator ""_KM ( unsigned long long value ) constexpr Length operator ""_KM ( unsigned long long value )
{ return Length{static_cast<double>(value)*1000} ; } { return Length{static_cast<double>(value*1000ll)} ; }
constexpr Length M { 1._M } ; constexpr Length M { 1._M } ;
constexpr Length KM { 1._KM } ; constexpr Length KM { 1._KM } ;
......
...@@ -4,8 +4,11 @@ template< typename UnderlyingType, typename TagType > ...@@ -4,8 +4,11 @@ template< typename UnderlyingType, typename TagType >
class StrongTypedef class StrongTypedef
{ {
public : public :
using UT = UnderlyingType ;
constexpr explicit StrongTypedef( UnderlyingType value ) : my_value{value} {} constexpr explicit StrongTypedef( UnderlyingType value ) : my_value{value} {}
constexpr explicit operator UnderlyingType() const { return my_value ; } constexpr explicit operator UnderlyingType() const { return my_value ; }
constexpr UnderlyingType operator*( UnderlyingType value ) const { return my_value*value ; }
constexpr UnderlyingType operator/( UnderlyingType value ) const { return my_value/value ; }
private : private :
UnderlyingType my_value ; UnderlyingType my_value ;
} ; } ;
...@@ -25,20 +28,20 @@ auto & operator<<( std::ostream & os, StrongTypedef<UT,TT> data ) ...@@ -25,20 +28,20 @@ auto & operator<<( std::ostream & os, StrongTypedef<UT,TT> data )
using Liter = StrongTypedef<double,struct LiterTag> ; using Liter = StrongTypedef<double,struct LiterTag> ;
constexpr Liter operator ""_L ( long double value ) constexpr Liter operator ""_L ( long double value )
{ return Liter(1.*value) ; } { return Liter{static_cast<Liter::UT>(1.l*value)} ; }
constexpr Liter operator ""_HL ( long double value ) constexpr Liter operator ""_HL ( long double value )
{ return Liter(100.*value) ; } { return Liter{static_cast<Liter::UT>(100.l*value)} ; }
constexpr Liter operator ""_CL ( long double value ) constexpr Liter operator ""_CL ( long double value )
{ return Liter(0.01*value) ; } { return Liter{static_cast<Liter::UT>(0.01l*value)} ; }
using Meter = StrongTypedef<double,struct MeterTag> ; using Meter = StrongTypedef<double,struct MeterTag> ;
constexpr Meter operator ""_M ( long double value ) constexpr Meter operator ""_M ( long double value )
{ return Meter(.00001*value) ; } { return Meter{static_cast<Meter::UT>(.00001l*value)} ; }
constexpr Meter operator ""_KM ( long double value ) constexpr Meter operator ""_KM ( long double value )
{ return Meter(.01*value) ; } { return Meter{static_cast<Meter::UT>(.01l*value)} ; }
constexpr Meter operator ""_MM ( long double value ) constexpr Meter operator ""_MM ( long double value )
{ return Meter(0.00000001*value) ; } { return Meter{static_cast<Meter::UT>(0.00000001l*value)} ; }
int main() int main()
{ {
......
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 6,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "subslide" "slide_type": "subslide"
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 7,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "subslide" "slide_type": "subslide"
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 8,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 9,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "subslide" "slide_type": "subslide"
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 10,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 11,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "skip" "slide_type": "skip"
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 12,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "subslide" "slide_type": "subslide"
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 13,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
...@@ -371,10 +371,10 @@ ...@@ -371,10 +371,10 @@
"#include <iostream>\n", "#include <iostream>\n",
"\n", "\n",
"long double operator \"\"_K ( long double value )\n", "long double operator \"\"_K ( long double value )\n",
" { return 1000.*value ; }\n", " { return 1000.l*value ; }\n",
"\n", "\n",
"unsigned long long operator \"\"_K ( unsigned long long value )\n", "unsigned long long operator \"\"_K ( unsigned long long value )\n",
" { return 1000*value ; }\n", " { return 1000ll*value ; }\n",
"\n", "\n",
"int main()\n", "int main()\n",
" {\n", " {\n",
...@@ -385,7 +385,7 @@ ...@@ -385,7 +385,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 14,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
...@@ -398,7 +398,7 @@ ...@@ -398,7 +398,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 15,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
...@@ -410,7 +410,7 @@ ...@@ -410,7 +410,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"5000 euros\n", "5000 euros\n",
"28300 mètres\n" "28300 meters\n"
] ]
} }
], ],
...@@ -495,7 +495,7 @@ ...@@ -495,7 +495,7 @@
"For strings of characters :\n", "For strings of characters :\n",
"* require `using namespace std::literals::string_literals` ;\n", "* require `using namespace std::literals::string_literals` ;\n",
"* since C++14 : `\"\"s` (`basic_string`) ;\n", "* since C++14 : `\"\"s` (`basic_string`) ;\n",
"* since C++17 : `\"\"sc` (`string_view`)." "* since C++17 : `\"\"sv` (`string_view`)."
] ]
}, },
{ {
...@@ -552,6 +552,8 @@ ...@@ -552,6 +552,8 @@
" public :\n", " public :\n",
" constexpr explicit StrongTypedef( UnderlyingType value ) : my_value{value} {}\n", " constexpr explicit StrongTypedef( UnderlyingType value ) : my_value{value} {}\n",
" constexpr explicit operator UnderlyingType() const { return my_value ; }\n", " constexpr explicit operator UnderlyingType() const { return my_value ; }\n",
" constexpr UnderlyingType operator*( UnderlyingType value ) const { return my_value*value ; }\n",
" constexpr UnderlyingType operator/( UnderlyingType value ) const { return my_value/value ; }\n",
" private : \n", " private : \n",
" UnderlyingType my_value ;\n", " UnderlyingType my_value ;\n",
" } ;\n", " } ;\n",
......
...@@ -494,7 +494,7 @@ ...@@ -494,7 +494,7 @@
"Pour les chaînes de caractères :\n", "Pour les chaînes de caractères :\n",
"* requière `using namespace std::literals::string_literals` ;\n", "* requière `using namespace std::literals::string_literals` ;\n",
"* à partir de C++14 : `\"\"s` (`basic_string`) ;\n", "* à partir de C++14 : `\"\"s` (`basic_string`) ;\n",
"* à partir de C++17 : `\"\"sc` (`string_view`)." "* à partir de C++17 : `\"\"sv` (`string_view`)."
] ]
}, },
{ {
......
...@@ -11,7 +11,7 @@ int main( int argc, char * argv[] ) ...@@ -11,7 +11,7 @@ int main( int argc, char * argv[] )
std::default_random_engine engine ; std::default_random_engine engine ;
if (mode=="non-deterministic") if (mode=="non-deterministic")
engine.seed(std::random_device()()) ; engine.seed(std::random_device{}()) ;
else if (mode!="deterministic") else if (mode!="deterministic")
throw "unknown mode" ; throw "unknown mode" ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment