Just to clarify, at 7:41 for a simple variable declaration it sounded as if the constexpr keyword does not mark a variable as 'const' and should also be marked const to make it const, which is not true. Marking a variable constexpr will indeed make it const too, thus not changeable. And if you try changing a constexpr variable, the compiler will complain about how that variable is declared as const.
@CopperSpice5 жыл бұрын
For clarification: As of C++14, if you have a constexpr method and you want it to be const, you must explicitly add a const qualifier. This was not a requirement in C++11. As we stated, constexpr does still imply const for variables but it is important to know the difference between these two keywords.
@ShadowaOsu5 жыл бұрын
@@CopperSpice after rewatching, I still couldn't catch the part where you explicitly stated that the keyword constexpr will make variables const actually. At 7:42 when you said constexpr will request the expression to be evaluated at compile time and then const qualifier will make their value not changeable, I thought it could lead to confusion for some viewers who aren't familiar with modern C++ as much, so just wanted to add a small clarification. Also, did I miss your mentioning about this? If so I apologize, please send me the time stamp for it. And I have to say that the video was really well prepared and amazing overall. Keep up the great work!