You can use boost::enable_if in conjunction with std:iterator_traits :
#include
#include
template
typename boost::enable_if<
boost::is_same<
int, /* replace by your type here */
typename std::iterator_traits::value_type
>
>::type getInts(OutputIterator it)
{
for (int i = 0; i < 5; ++i)
*it++ = i;
}