maybe a simpler unique_ptr

This commit is contained in:
2023-01-14 20:00:55 -08:00
parent 0d3c9e3422
commit 6614e5e8ea
3 changed files with 7 additions and 25 deletions

View File

@@ -13,6 +13,8 @@
namespace {
using It = std::istream_iterator<std::string>;
//
template <typename T>
auto DivMod(T dividend, T divisor) -> std::pair<T, T>
@@ -59,8 +61,7 @@ auto ToInt(std::string const& str) -> T
auto Solve(std::istream & in) -> std::string
{
using It = std::istream_iterator<std::string>;
return FromInt(std::transform_reduce(It(in), It(), 0, std::plus(), ToInt<std::int64_t>));
return FromInt(std::transform_reduce(It{in}, It{}, std::int64_t{}, std::plus(), ToInt<std::int64_t>));
}
} // namespace