這個語法被用作一個答案的一部分this question:請幫我理解這句法(實現用C靜態斷言++)
template <bool>
struct static_assert;
template <>
struct static_assert<true> {}; // only true is defined
#define STATIC_ASSERT(x) static_assert<(x)>()
我不明白語法。它是如何工作的?
假設我
STATIC_ASSERT(true);
它被轉化爲
static_assert<true>();
現在怎麼辦?
:) – GManNickG 2010-06-23 08:07:59