Just to share my idea of constexpr.
C++ has a strict separation between runtime and compiletime. All about compiletime was assisted with <> characters syntax before constexpr.
And I have no idea why constexpr was introduced. It was easier to embrace <expression> with <> to specify that it is strict compile time.
<i>: int defines compile time variable,
i.e. translates to constexpr int i
if <args.cout> == 3 {
p = a&;
}
Forces <expression> to be compile-time, i.e. translates to
if constexpr (args.cout == 3) {
p = a&;
}
Just to share my idea of
constexpr.C++ has a strict separation between runtime and compiletime. All about compiletime was assisted with
<>characters syntax beforeconstexpr.And I have no idea why
constexprwas introduced. It was easier to embrace<expression>with<>to specify that it is strict compile time.<i>: intdefines compile time variable,i.e. translates to
constexpr int iForces
<expression>to be compile-time, i.e. translates to