I wonder if it is possible using boost::mpl/preprocessor or some noce C++11 features to create function proxy from class type and function name.
Say we had:
inline void set_email(const ::std::string& value);
inline void set_email(const char* value);
inside class Email. We know there is set_email function n it, we want to create a prox class with API like
PROXY(Email, set_email, MyEmail)
Email * email = new Email();
MyEmail * myEmail = new MyEmail(email);
and have abilety to call any of set_email overloads.Is it possible and how to create such class that would proxy any number of overload functions not knowing there types (only names)?
How about this:
proxy_macro.hpp
This compiles and work fine for me on
g++ 4.7:Edit (smaller version thanks to comments)
proxy_macro.hpp