io: add slurp overload for string views

This commit is contained in:
Danny Robson 2018-01-30 11:32:38 +11:00
parent c4e0cd31f9
commit 8682381618

7
io.hpp
View File

@ -39,6 +39,13 @@ namespace util {
template <typename T = std::byte> template <typename T = std::byte>
std::vector<T> slurp (const std::experimental::filesystem::path&); std::vector<T> slurp (const std::experimental::filesystem::path&);
template <typename T = std::byte, typename A, typename B>
std::vector<T> slurp (util::view<A,B> path)
{
const std::experimental::filesystem::path src { path.begin (), path.end () };
return slurp<T> (src);
}
template <typename T = std::byte> template <typename T = std::byte>
std::vector<T> slurp (FILE *); std::vector<T> slurp (FILE *);