2 Comments
User's avatar
Marius Mikučionis's avatar

When you have iterator and want a vector, you do not have to copy, just use the ctor or vector::assign, keep it simple :-)

return std::vector(std::istreambuf_iterator<char>{file}, std::streambuf_iterator<char>{});

Expand full comment
Šimon Tóth's avatar

Yup, I keep forgetting that this constructor exists.

Expand full comment