Just use std::copy() with a special iterator.
#include <algorithm>
#include <iostream>
#include <iterator>
struct number_iterator
{
typedef std::input_iterator_tag iterator_category;
typedef int value_type;
typedef std::size_t difference_type;
typedef int* pointer;
typedef int& reference;
number_iterator(int v): value(v) {}
bool operator != (number_iterator const& rhs) { return value != rhs.value;}
number_iterator operator++() { ++value; return *this;}
int operator*() { return value; }
int value;
};
int main()
{
std::copy(number_iterator(1),
number_iterator(1001),
std::ostream_iterator<int>(std::cout, " "));
}