Skip to content

Instantly share code, notes, and snippets.

@aserio
Created January 5, 2018 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aserio/5be31d15f0c6185c5e8f6d3b56ab66e2 to your computer and use it in GitHub Desktop.
Save aserio/5be31d15f0c6185c5e8f6d3b56ab66e2 to your computer and use it in GitHub Desktop.
Trying to get compiler to choose correct arch_data
// Function object for save_checkpoint
namespace detail {
//Properly handle Component Clients
template <typename Client, typename Server>
void arch_data(hpx::serialization::output_archive & ar
, hpx::components::client_base<Client, Server> && c)
{
hpx::future<std::shared_ptr<Server>> f_ptr = hpx::get_ptr<Server>(c.get_id());
std::shared_ptr<Server> ptr = f_ptr.get();
ar << ptr;
std::cout << "It worked!" << std::endl;
}
template<typename T>
void arch_data(hpx::serialization::output_archive & ar, T && t)
{
ar << t;
}
struct save_funct_obj
{
template <typename... Ts>
checkpoint operator()(checkpoint&& c, Ts&&... ts) const
{
// Create serialization archive from checkpoint data member
hpx::serialization::output_archive ar(c.data);
// Serialize data
int const sequencer[] = {// Trick to expand the variable pack
// 0, (ar << ts,0)... // Takes advantage of the comma operator
0, (arch_data(ar, std::move(ts)),0)... // Takes advantage of the comma operator
};
(void) sequencer; // Suppress unused param. warnings
return c;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment