Constexpr compile time checking

Is it possible to print a message when a constexpr compile-time test evaluates to true? Something like static_assert without stopping the compiler.

constexpr Application::Mode SETUP_MODE = Application::Debug;

// Can I somehow test if the SETUP_MODE is debug for pragma message?
#pragma message("Application mode is set to Debug!")

static_assert(SETUP_MODE != Application::Debug, 
    "Application mode is set to Debug!"); // Can I somehow just print this message without aborting the compilation?

      

+3


source to share





All Articles