C++ member function wrapper for interfacing with C APIs
After using the code for a while I noticed the following changes could be used:


I don't need instance_type_helper class. Result type will be taken out of the function type. Thus, instance_call_helper turns into following:

template&lt;
    typename Function,
    Function F
&gt;
struct instance_call_helper;

template&lt;
    typename Result,
    typename Base,
    typename... Args,
    Result(Base::* Func)(Args...)
&gt;
struct instance_call_helper&lt;
    Result(Base::*)(Args...),
    Func
&gt;

In order to use this code with GCC 6, one can check the value of __cpp_deduction_guides macro:

#if __cpp_deduction_guides &gt;= 201606
template&lt;
    auto F
&gt;
#else
template&lt;
    typename Function,
    Function F
&gt;
#endif

For use with C code (it's not portable, as noticed in the comments), some more advanced typechecking can be used for arguments, like std::is_fundamental or std::is_pod