begin and end overloads for istream_iterator I wrote this pretty straight forward begin and end overloads for istream_iterator. 

Is this standards compliant? Any problems with usage?

#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &lt;fstream&gt;

namespace std
{

    template &lt;typename T&gt;
    std::istream_iterator&lt;T&gt; begin(std::istream_iterator&lt;T&gt; iter)
    {
        return iter;
    }

    template &lt;typename T&gt;
    std::istream_iterator&lt;T&gt; end(std::istream_iterator&lt;T&gt;)
    {
        return std::istream_iterator&lt;T&gt;();
    }

}

int main()
{
    for (std::string s : std::istream_iterator&lt;std::string&gt;(std::cin))
    {
        std::cout &lt;&lt; s;
    }
}
Not sure that's how I would have written in.
Its not normal to call std::begin() and std::end() on an iterator.

I would have arranged for a some type to represent the stream as a container:

#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &lt;fstream&gt;

namespace ThorsAnvil
{
    template&lt;typename T&gt;
    struct StreamAsContainer
    {
        std::istream&amp; str;
        StreamAsContainer(std::istream&amp; str) : str(str) {}
    };

    template &lt;typename T&gt;
    std::istream_iterator&lt;T&gt; begin(StreamAsContainer&lt;T&gt;&amp; c)
    {
        return std::istream_iterator&lt;T&gt;(c.str);
    }

    template &lt;typename T&gt;
    std::istream_iterator&lt;T&gt; end(StreamAsContainer&lt;T&gt;&amp;)
    {
        return std::istream_iterator&lt;T&gt;();
    }

}

int main()
{
    namespace TA=ThorsAnvil;
    for (std::string s : TA::StreamAsContainer&lt;std::string&gt;(std::cin))
    {
        std::cout &lt;&lt; s;
    }
}