#pragma once #include "binary-serializer.hpp" #include #include namespace floormat::Serialize { template It> struct binary_writer final { explicit constexpr binary_writer(It it, size_t allocated_bytes) noexcept; template constexpr void write(T x) noexcept; constexpr void write_asciiz_string(StringView str) noexcept; constexpr size_t bytes_written() const noexcept { return _bytes_written; } constexpr size_t bytes_allocated() const noexcept { return _bytes_allocated; } private: It it; size_t _bytes_written, _bytes_allocated; }; template It, serializable T> constexpr binary_writer& operator<<(binary_writer& writer, T x) noexcept; } // namespace floormat::Serialize