is_integral vs is_integer: is one of them redundant?
c++, c++11, stl
Solution
`std::numeric_limits<T>::is_integer` was not introduced by C++11. It was just updated to use the new `constexpr` qualifier.
`std::is_integral<T>` was introduced by C++11, and you're right it gives the same results. As to why it was added - possibly because the integral-ness or otherwise of a type isn't logically part of that type's `numeric_limits`?
It seems to be the goal of the `<type_traits>` header to gather all the type classification helpers in one place, while the older `numeric_limits` collects only properties specific to, well, numbers. If `numeric_limits<T>::is_integer` were deprecated, there'd be a slightly arbitrary boundary which type traits lived in `<type_traits>`, and which were considered numerical. It's hardly a terrible duplication to have it in both places.
Problem
is_integral and is_integer seem to answer the same thing in the same way. From the links to the related documentation pages, `is_integral` seems to be missing specializations for the following types ``` signed char unsigned char unsigned short unsigned int unsigned long unsigned long long ``` Yet a compiled example, shows (of course) their identical behaviour on those types as well: ``` #include <iostream> #include <type_traits> using namespace std; int main() { cout << is_integral<signed char >::value << endl; cout << is_integral<unsigned char >::value << endl; cout << is_integral<unsigned short >::value << endl; cout << is_integral<unsigned int >::value << endl; cout << is_integral<unsigned long >::value << endl; cout << is_integral<unsigned long long>::value << endl; return 0; } ``` So if they also behave the same, what was the point of introducing both of them in C++11? So if they also behave the same, what was the point of introducing both of them in c++11 ? Edit : rephrasings As Useless points out, the phrase including any signed, unsigned, and cv-qualified variants from the `is_integral` doc page reveals that even their specifications are a complete match.