// Copyright (c) 2012-2013 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once #include #include #include #include #include #include #include #include "serialization.h" template struct variant_serialization_traits { }; template struct variant_reader { typedef typename Archive::variant_tag_type variant_tag_type; typedef typename boost::mpl::next::type TNext; typedef typename boost::mpl::deref::type current_type; static inline bool read(Archive &ar, Variant &v, variant_tag_type t) { if (variant_serialization_traits::get_tag() == t) { current_type x; if(!::do_serialize(ar, x)) { ar.stream().setstate(std::ios::failbit); return false; } v = x; } else { return variant_reader::read(ar, v, t); } return true; } }; template struct variant_reader { typedef typename Archive::variant_tag_type variant_tag_type; static inline bool read(Archive &ar, Variant &v, variant_tag_type t) { ar.stream().setstate(std::ios::failbit); return false; } }; template