// This file is part of Desktop App Toolkit, // a set of libraries for developing nice desktop applications. // // For license and copyright information please follow this link: // https://github.com/desktop-app/legal/blob/master/LEGAL // #pragma once #include "base/basic_types.h" #include namespace tl { template struct Writer; template class boxed : public bare { public: using bare::bare; boxed() = default; boxed(const boxed &v) = default; boxed &operator=(const boxed &v) & = default; boxed(const bare &v) : bare(v) { } boxed &operator=(const bare &v) & { *((bare*)this) = v; return *this; } template [[nodiscard]] bool read(const Prime *&from, const Prime *end, uint32 cons = 0) { if (!Reader::Has(1, from, end)) { return false; } cons = Reader::Get(from, end); return bare::read(from, end, cons); } template void write(Accumulator &to) const { Writer::Put(to, bare::type()); bare::write(to); } using Unboxed = bare; }; template class boxed > { using Unboxed = typename T::CantMakeBoxedBoxedType; }; template struct is_boxed : std::false_type { }; template struct is_boxed> : std::true_type { }; template inline constexpr bool is_boxed_v = is_boxed::value; } // namespace tl