Commit 07eaf7fb authored by Matthieu Dorier's avatar Matthieu Dorier

made it possible to serialize rvalues

parent 68d43bdb
......@@ -149,10 +149,15 @@ struct saver<A,T,false> {
* Generic save method calling apply on a saver.
*/
template<class A, typename T>
inline void save(A& ar, T&& t) {
inline void save(A& ar, T& t) {
saver<A,T,has_save_method<A,T>::value>::apply(ar,std::forward<T>(t));
}
template<class A, typename T>
inline void save(A& ar, T&& t) {
save(ar, t);
}
/**
* Loader structure, will provide an apply method that depends
* on the presence of a load function in the provided type.
......@@ -178,10 +183,15 @@ struct loader<A,T,false> {
* Generic load method calling allpy on a loader.
*/
template<class A, typename T>
inline void load(A& ar, T&& t) {
inline void load(A& ar, T& t) {
loader<A,T,has_load_method<A,T>::value>::apply(ar,std::forward<T>(t));
}
template<class A, typename T>
inline void load(A& ar, T&& t) {
load(ar, t);
}
/**
* Helper function that serializes an arbitrary number of
* objects passed as arguments.
......
......@@ -50,9 +50,7 @@ int client() {
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
std::string name("Matthieu");
remote_hello.on(server_endpoint)(name);
remote_hello.on(server_endpoint)(std::string("Matt"));
int ret = remote_sum.on(server_endpoint)(23,67);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment