编译时间消息测试constexpr

时间:2017-05-19 19:22:44

标签: c++ c++14 constexpr static-assert

在编译时constexpr的测试是否真实时,是否可以打印消息?类似于static_assert而不停止编译器。

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?

0 个答案:

没有答案