(kHit >= kForeground) , true false. -, bool int, 1 true 0 false. -1 0, uchar .
, , operator- , int, . :
template <typename T, typename U>
struct same_type {
static const bool value = false;
};
template <typename T>
struct same_type<T,T> {
static const bool value = true;
};
template <typename T>
void f( T value ) {
std::cout << "Is int? " << std::boolalpha << same_type<T, int>::value << "\n";
std::cout << "Is bool? " << same_type<T, bool>::value << "\n";
}
int main() {
f(-true);
}
f int bool same_type ( ). f -true , T -true. , , Is int? true\nIs bool? false.