A very simplified version of my code is this:
#define proxy(name, type, arg) \
void name(function_list_object* obj, type arg) \
{ \
void (*foo)(type arg) = obj->find_ptr_for(STRINGIZE(name)); \
foo(arg); \
} \
proxy(fi, int, i);
Which works perfectly fine. However with C++11:
proxy(fs, std::string&&, rvrs);
... expectedly leads to an error, since I need std::move
to transfer the rvalue to another level.
I'm thinking of such a solution but I'm not sure it will be always safe:
#if defined(MY_CXX11)
# define MY_MOVE(x) std::move(x)
#else
# define MY_MOVE(x) x
#endif
#define proxy(name, type, arg) \
void name(function_list_object* obj, type arg) \
{ \
void (*foo)(type arg) = obj->find_ptr_for(STRINGIZE(name)); \
foo(MY_MOVE(arg)); \
} \
It seems to me that this will work for all possible types. Am I right?