#ifndef IS_INTEGRAL_HPP # define IS_INTEGRAL_HPP namespace ft { template struct is_integral { typedef char yes[1]; typedef yes no[2]; static T type; // integral types : https://www.cplusplus.com/reference/type_traits/is_integral/ static yes& test(bool); static yes& test(char); // static yes& test(char16_t); // static yes& test(char32_t); static yes& test(wchar_t); static yes& test(signed char); static yes& test(short int); static yes& test(int); static yes& test(long int); static yes& test(long long int); static yes& test(unsigned char); static yes& test(unsigned short int); static yes& test(unsigned int); static yes& test(unsigned long int); static yes& test(unsigned long long int); // non-template function with direct matching are always considered first // then the function template with direct matching are considered // https://stackoverflow.com/questions/12877546/how-do-i-avoid-implicit-conversions-on template static no& test(C); static const bool value = sizeof(test(type)) == sizeof(yes); }; } // namespace ft // "template <>" introduce a total specialization of a template : // https://stackoverflow.com/questions/6288812/what-is-the-meaning-of-template-with-empty-angle-brackets-in-c // SFINAE : https://jguegant.github.io/blogs/tech/sfinae-introduction.html #endif