#include #include #include #include #include #include #include #include #include #include "fmt/std.h" #include "aoc/types.hpp" #include "aoc/utils.hpp" using namespace std::string_view_literals; using namespace aoc::types; // simple pipe for std::string by value template auto operator|(std::string s, F&& f) -> decltype(auto) { return std::forward(f)(std::move(s)); } auto ltrim(std::string s) -> std::string { s.erase( std::begin(s), std::find_if(s.begin(), s.end(), [](char ch) { return !std::isspace(static_cast(ch)); })); return s; } auto rtrim(std::string s) -> std::string { s.erase( std::find_if(s.rbegin(), s.rend(), [](char ch) { return !std::isspace(static_cast(ch)); }).base(), s.end()); return s; } auto trim(std::string s) -> std::string { return ltrim(rtrim(std::move(s))); } // starts at 50 constexpr auto raw_str = R"( L68 L30 R48 L5 R60 L55 L1 L99 R14 L82 )"; enum class rotdir { L, R }; struct rot { rotdir dir; u32 turns; }; static auto entry([[maybe_unused]]std::span const& args) -> void { std::string str{raw_str}; str = str | trim; fmt::print("{}\n", str); auto rot_vec = str | std::views::split("\n"sv) | std::views::transform([](auto const& str) { return 0; }) | std::ranges::to(); } auto main([[maybe_unused]]int argc, [[maybe_unused]]char const* argv[]) -> int { try { entry({argv, std::next(argv, argc)}); } catch (std::exception const& e) { fmt::print(stderr, "{}\n", e.what()); return 1; } return 0; }