ifstream_iterator and ifstream
<p>The task is to read numbers from file to vector. Format is: one number per line. I want to make with STL-style. So, I wrote such code:</p>

<pre><code>::std::deque&lt;size_t&gt; Input(const ::std::string&amp; filename) {
    ::std::deque&lt;size_t&gt; result;
    try {
        ::std::ifstream file(filename.c_str(), ::std::ios::binary);
        file.exceptions(::std::ifstream::failbit |
                       ::std::ifstream::badbit);

        ::std::copy(::std::istreambuf_iterator&lt;size_t&gt;(file),
                    ::std::istreambuf_iterator&lt;size_t&gt;(),
                    ::std::back_inserter(result));

    } catch ( ::std::exception&amp; e ) {
        ::std::cout &lt;&lt; e.what() &lt;&lt; ::std::endl;
    }
    return result;
}
</code></pre>

<p>It works fine, and I get what I want (all numbers from the file), but also I get an exception with failbit at end of file. What's the problem? I don't want to use getline() and parse by hand -- wanna ask STL do it for me.
UPDATE: I checked -- there is no new line at the end of file.</p>
