How is constexpr
different from const
, and how does it contribute to making modern C++ code cleaner and simpler, as well as faster than ever? Danny Kalev gives a nice summary:
Using constexpr to Improve Security, Performance and Encapsulation in C++
by Danny Kalev
constexpr
is a new C++11 keyword that rids you of the need to create macros and hardcoded literals. It also guarantees, under certain conditions, that objects undergo static initialization. Danny Kalev shows how to embedconstexpr
in C++ applications to define constant expressions that might not be so constant otherwise.
Add a Comment
Comments are closed.