, , ( ).
++ 0x:
#include <utility>
template <class T>
void foo(T )
{
static_assert(std::is_integral<T>::value, "Only integral types allowed");
}
int main()
{
foo(3);
foo(3.14);
}
++ 03, boost :
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
template <class T>
void foo(T )
{
BOOST_STATIC_ASSERT(boost::is_integral<T>::value);
}
int main()
{
foo(3);
foo(3.14);
}
(IMO, enable_if , - . , , : " ", , .)