C++11y allows us to eliminate some boilerplate!
[invirt/third/libt4.git] / rpc / marshall.h
index 08b6aaa..8d5812a 100644 (file)
@@ -116,7 +116,7 @@ MARSHALL_RAW_NETWORK_ORDER(int64_t)
 // the appropriate tag struct to make this possible.
 
 template <class... Args, size_t... Indices> inline marshall &
-tuple_marshall_imp(marshall & m, tuple<Args...> & t, tuple_indices<Indices...>) {
+tuple_marshall_imp(marshall & m, tuple<Args...> & t, std::index_sequence<Indices...>) {
     // Note that brace initialization is used for the empty structure "pack",
     // forcing the comma-separated expressions expanded from the parameter pack
     // to be evaluated in order.  Order matters because the elements must be
@@ -128,18 +128,18 @@ tuple_marshall_imp(marshall & m, tuple<Args...> & t, tuple_indices<Indices...>)
 
 template <class... Args> inline marshall &
 operator<<(marshall & m, tuple<Args...> && t) {
-    return tuple_marshall_imp(m, t, TUPLE_INDICES(Args));
+    return tuple_marshall_imp(m, t, std::index_sequence_for<Args...>{});
 }
 
 template <class... Args, size_t... Indices> inline unmarshall &
-tuple_unmarshall_imp(unmarshall & u, tuple<Args & ...> t, tuple_indices<Indices...>) {
+tuple_unmarshall_imp(unmarshall & u, tuple<Args & ...> t, std::index_sequence<Indices...>) {
     (void)pass{(u >> std::get<Indices>(t))...};
     return u;
 }
 
 template <class... Args> inline unmarshall &
 operator>>(unmarshall & u, tuple<Args & ...> && t) {
-    return tuple_unmarshall_imp(u, t, TUPLE_INDICES(Args));
+    return tuple_unmarshall_imp(u, t, std::index_sequence_for<Args...>{});
 }
 
 //