Daily bit(e) of C++ #446, Launching or deferring callables using std::async and std::launch.
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>{});
Yup, I keep forgetting that this constructor exists.
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>{});
Yup, I keep forgetting that this constructor exists.