Добрый день, помогите разобраться со след. кодом:
template<bool> struct CompileTimeError;
template<> struct CompileTimeError<true> {};
#define STATIC_CHECK(expr) \
(CompileTimeError<(expr) != 0>())
Описание:
CompileTimeError is a template taking a nontype parameter (a Boolean constant). Compile-TimeError is defined only for the true value of the Boolean constant. If you try to instantiate CompileTimeError<false>, the compiler utters a message such as "Undefined specialization CompileTimeError<false>." This message is a slightly better hint that the error is intentional and not a compiler or a program bug.
Мне не понятна вторая строка:
template<> struct CompileTimeError<true> {};
В первой строке объявляется шаблонная структура CompileTimeError;
По идее во второй строке — определение этой структуры, но если я правильно понимаю, определение должно было выглядить след образом:
CompileTimeError<true> {};