I've always loved robotics so I focused on learning that. I've worked on destkop applications, on drones, and now on exoskeletons! Web dev looks scary to me but there is a lot of potential there.
Location
France
Education
Master of Engineering
Work
Critical Embedded Software engineer at Wandercraft
And I encourage you to do so, since you can end up with methods and functions using only elements with constexpr elements and add the constexpr keyword to those functions/methods and allow them to be performed by the compiler, at compile time, instead of being executed at run time.
Here is a godbolt link if you want to experiment with constexpr and C++ in general ;)
I will also add a link to the documentation of constexpr in the article so that people can easily find it
Does
constexpr
replaceconst
for these kind of constants?Can we just do this:
every time we need a constant and it will behave the same as
const
with added benefits ofconstexpr
?Yes, it can.
And I encourage you to do so, since you can end up with methods and functions using only elements with
constexpr
elements and add theconstexpr
keyword to those functions/methods and allow them to be performed by the compiler, at compile time, instead of being executed at run time.Here is a godbolt link if you want to experiment with
constexpr
and C++ in general ;)I will also add a link to the documentation of
constexpr
in the article so that people can easily find itI remembered those 2 conference videos about
constexpr
. You may found it useful to see the benefits ofconstexpr
;)constexpr ALL the Things!”
Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17