/checkpoint_exerpt.cpp Secret
Last active
January 5, 2018 22:36
-
-
Save hkaiser/0d768822781c42704b8eec3c789c597c 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 T> | |
typename std::enable_if<traits::is_client<T>::value>::type | |
arch_data(hpx::serialization::output_archive & ar, T && 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> | |
typename std::enable_if<!traits::is_client<T>::value>::type | |
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