/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2022, Danny Robson */ #pragma once #include "./converter.hpp" #include #include namespace cruft::serialise { template cruft::view to_bytes [[nodiscard]] (cruft::view dst, ValueT const &src) { return converter::to_bytes (dst, src); } template cruft::view to_bytes [[nodiscard]] (cruft::view dst, HeadT const &head, TailT&& ...tail) { dst = to_bytes (dst, head); if constexpr (sizeof... (TailT)) dst = to_bytes (dst, std::forward (tail)...); return dst; } template ValueT from_bytes (cruft::view &src) { return converter::from_bytes (src); } template std::size_t size (ArgsT &&...args) { return (converter::size (args) + ... + 0uz); } }