Reading n chars from stream to string
Why not:

static string Read(istream &amp;stream, uint32_t count)
{
    std::string result(count, ' ');
    stream.read(&amp;result[0], count);

    return result;
}


Though not strictly C++03 compatible that is easily validated. One of the reasons the committee found it easy to add the new constraint in C++11 was that no implementation did not use contiguous memory (Random Access Iterators are a hint).

But a C++03 strict implementation would be:

static string Read(istream &amp;stream, uint32_t count)
{
    std::vector&lt;char&gt; result(count);  // Because vector is guranteed to be contiguous in C++03
    stream.read(&amp;result[0], count);

    return std::string(&amp;result[0], &amp;result[count]);
}