bitwise: prefer template SFINAE over param SFINAE

This commit is contained in:
Danny Robson 2018-08-07 16:58:02 +10:00
parent d3c5af6fdf
commit 1c814c02d2

View File

@ -76,9 +76,14 @@ namespace cruft {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template <typename T> template <
typename T,
typename = std::enable_if_t<
std::is_integral_v<T>
>
>
constexpr T constexpr T
popcount (std::enable_if_t<std::is_integral<T>::value,T> t) popcount (T t)
{ {
return __builtin_popcount (t); return __builtin_popcount (t);
} }