Someone have an idea how to check if an arbitrary method is const?
Like:
static_assert(is_const<vector<int>::size>::value, "size is not const");
static_assert(!is_const<vector<int>::push_back>::value, "push_back is const");
Good question T.C :) I am finding an particular overload of the method and I want to only set an modified flag if the method i found is non-const.
Here is my templates and maroes:
#define FRET_DECL_TYPE(Function) \
template<typename T_, typename ... Args_> \
struct f_ret##Function { typedef decltype(std::declval<T_&>().Function(std::declval<Args_&&>()...)) type; };
#define RPROP_PROXY_METHOD(Function) \
FRET_DECL_TYPE(Function) \
template<typename ... Args> \
typename f_ret##Function<T, Args...>::type \
Function(Args&& ... args) const { return this->GetReference().Function(static_cast<Args&&>(args)...); }; \
template<typename ... Args> \
typename f_ret##Function<T, Args...>::type \
Function(Args&& ... args) { this->SetModified(true); return this->GetReference().Function(static_cast<Args&&>(args)...); }; \