std :: is_integer和std :: is_integral之间的区别? [英] Differences between std::is_integer and std::is_integral?
问题描述
C ++ 11提供了两个类型特征模板类:std::is_integer
和std::is_integral
.但是,我无法分辨它们之间的区别.
C++11 provides two type trait template classes: std::is_integer
and std::is_integral
. However, I cannot tell the differences between them.
哪种类型(例如T)可以使std::is_integer<T>::value
为真,而使std::is_integral<T>::value
为假?
What type, say T, can make std::is_integer<T>::value
true and make std::is_integral<T>::value
false?
推荐答案
std::is_integer<T>
不存在.
话虽这么说,std::numeric_limits<T>::is_integer
确实存在.
That being said, std::numeric_limits<T>::is_integer
does exist.
我不知道std::numeric_limits<T>::is_integer
和std::is_integral<T>
之间的任何显着差异.后者的设计要晚得多,并且在C ++ 11中成为标准,而前者是在C ++ 98中引入的.
I'm not aware of any significant difference between std::numeric_limits<T>::is_integer
and std::is_integral<T>
. The latter was designed much later and became standard in C++11, whereas the former was introduced in C++98.
这篇关于std :: is_integer和std :: is_integral之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!