-
-
Save aserio/5be31d15f0c6185c5e8f6d3b56ab66e2 to your computer and use it in GitHub Desktop.
Trying to get compiler to choose correct arch_data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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