C++ Advanced · exercise 04
Compile-time unit safety
Make a wrong unit a compile error and keep the maths constexpr.
C++ Advanced lesson 04Guided steps
- 1.Give Radians a constexpr constructor and a constexpr addition that only accepts Radians.
- 2.Prove the result at compile time with static_assert.
- 3.Print the runtime value of the same constant.
Your code
Your code is saved in this browser after every run and restored next time.