rename class instance member function

Hi, i can rename std::next to n,
and i want to rename list instance member function.(push_back to put)
thanks.

std::list<int> a; // a.push_back -> a.put


ALIAS_TEMPLATE_FUNCTION(n, std::next)

#define ALIAS_TEMPLATE_FUNCTION(highLevelF, lowLevelF) \
template<typename... Args> \
inline auto highLevelF(Args&&... args) -> decltype(lowLevelF(std::forward<Args>(args)...)) \
{ \
return lowLevelF(std::forward<Args>(args)...); \
}

You can't do that. At least not without "hacks".
I think it is not practicable, we can not add new method or change method in a given class. unless you specialize std::list<> for int type.

By the way, what's your purpose by renaming a member function? Could you use lambda, std::function,std::bind or some other things?
Registered users can post here. Sign in or register to post.