educative.io

Constant Expressions Exercises - Seeking Clarification

The exercises ask:

How can we check that instances of MyDouble will be created at compile-time?

I don’t understand exactly what this is asking me to do or how to translate that into code. Can you provide some additional guidance?

For the examples, it appears the provided code is incorrect. Line 6 of exercise 1 should read:
constexpr double getVal() const { return myVal; }

When adding the ‘const’ you can then do a static_assert on getVal() without errors.