2 Comments

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

Yup, I keep forgetting that this constructor exists.

Expand full comment