Small reading utility.

This commit is contained in:
2019-12-03 18:43:13 +01:00
parent 3dca1a46e1
commit b31d56c4ac
2 changed files with 7 additions and 1 deletions

View File

@@ -1,10 +1,16 @@
#pragma once
#include <charconv>
#include <functional>
#include <string_view>
namespace aoc2019 {
template<typename T>
inline std::from_chars_result from_chars(std::string_view str, T& value) {
return std::from_chars(str.data(), str.data() + str.size(), value);
}
template<typename T>
void combine_hash(std::size_t& seed, const T& o) {
// Algorithm taken from boost::combine_hash.