Ada*_*adi 5 c++ static-assert constexpr c++14
当对编译时 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?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
598 次 |
| 最近记录: |