finish day 4
This commit is contained in:
19
utils.h
Normal file
19
utils.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Created by Grant Horner on 12/4/25.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
|
||||
constexpr std::string_view to_string_view(const std::ranges::subrange<const char *> cs) {
|
||||
return std::string_view{cs.data(), cs.size()};
|
||||
}
|
||||
|
||||
inline std::string read_file(std::string_view path) {
|
||||
std::ifstream input(path.data());
|
||||
std::stringstream buffer;
|
||||
buffer << input.rdbuf();
|
||||
return buffer.str();
|
||||
}
|
||||
Reference in New Issue
Block a user