Skip to content

Instantly share code, notes, and snippets.

@hkaiser
Created March 20, 2020 22:14
Show Gist options
  • Save hkaiser/e7eb766330ef01c716314f5c6d1a2a00 to your computer and use it in GitHub Desktop.
Save hkaiser/e7eb766330ef01c716314f5c6d1a2a00 to your computer and use it in GitHub Desktop.
// Copyright (c) 2020 Yorlik
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <hpx/hpx.hpp>
#include <hpx/hpx_main.hpp>
#include <hpx/serialization.hpp>
#include <variant>
struct thing
{
std::variant<int, double, std::string> v;
std::variant<std::string, double, int64_t> w;
template <typename Archive>
void serialize(Archive& ar, unsigned version)
{
// clang-format off
ar & v;
ar & w;
// clang-format on
}
};
int main(int argc, char* argv[])
{
std::vector<std::byte> cont;
hpx::serialization::output_archive ar(cont);
thing X;
ar << X;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment