#include "marshall.h"
-typedef function<rpc_protocol::status(unmarshall &&, marshall &)> handler;
+typedef std::function<rpc_protocol::status(unmarshall &&, marshall &)> handler;
//
// Automatic marshalling wrappers for RPC handlers
template <class F, class R, class RV, class args_type, size_t... Indices>
typename enable_if<!is_member_function_pointer<F>::value, RV>::type inline
invoke(RV, F f, void *, R & r, args_type & t, tuple_indices<Indices...>) {
- return f(r, move(get<Indices>(t))...);
+ return f(r, get<Indices>(t)...);
}
// And one for pointers to member functions...
template <class F, class C, class RV, class R, class args_type, size_t... Indices>
typename enable_if<is_member_function_pointer<F>::value, RV>::type inline
invoke(RV, F f, C *c, R & r, args_type & t, tuple_indices<Indices...>) {
- return (c->*f)(r, move(get<Indices>(t))...);
+ return (c->*f)(r, get<Indices>(t)...);
}
// The class marshalled_func_imp uses partial template specialization to
template <class F, class C, class ErrorHandler, class R, class RV, class... Args>
struct marshalled_func_imp<F, C, RV(R &, Args...), ErrorHandler> {
static inline handler *wrap(F f, C *c=nullptr) {
- // This type definition corresponds to an empty struct with
- // template parameters running from 0 up to (# args) - 1.
- using Indices = typename make_tuple_indices<sizeof...(Args)>::type;
// This type definition represents storage for f's unmarshalled
// arguments. decay is (most notably) stripping off const
// qualifiers.
// Allocate space for the RPC response -- will be passed into the
// function as an lvalue reference.
R r;
- // Perform the invocation. Note that Indices() calls the default
- // constructor of the empty struct with the special template
- // parameters.
- RV b = invoke(RV(), f, c, r, t, Indices());
+ // Perform the invocation. Note that TUPLE_INDICES calls the
+ // default constructor of an empty struct with template parameters
+ // running from 0 up to (# args) - 1.
+ RV b = invoke(RV(), f, c, r, t, TUPLE_INDICES(Args));
// Marshall the response.
m << r;
// Make like a tree.
public marshalled_func_imp<F, C, RV(Args...), ErrorHandler> {};
template <class F, class ErrorHandler, class Signature>
-struct marshalled_func<F, ErrorHandler, function<Signature>> :
+struct marshalled_func<F, ErrorHandler, std::function<Signature>> :
public marshalled_func_imp<F, void, Signature, ErrorHandler> {};
#endif