c++ - How to remove const qualifier from a member function pointer -


I am using a library that contains the following code:

  lt; Typename M & gt; Void _register_member (lua_State * state, const char * member_name, M T :: * member) {std :: function & lt; M (T *) & gt; Lambda_get = [member] (t * t) {// ^ error return here T->; Member; }; // ...   

However this code does not accept the member function pointer that passes the error to the function function type 'zero () ' or the Constant member can not return any type of function.

How do I remove Constable? Member has passed the work or how can I implement std :: remove_const ?

The observation states that this error occurs when it tries to compile that Uses the library:

  #include & lt; Selene.h & gt; Square C {public: bool get () console; }; Bool C :: get () const {return true;} int main () {cell :: state state; State ["c"]. SetClass & lt; C & gt; ("Get", and & amp; ac :: get); }   

The compiler fails to compile the code in the header. Function Members in two overloaded classes of _register_member in :

  template & lt; Typename t, typename a, typename .. member & gt; Classroom class: Public base class {Private: // ... template & lt; Typename M & gt; Void _register_member (lua_State * state, const char * member_name, M T :: * member) {// ...} Type template & typ, type name ... Args & gt; Zero _register_member (lua_State * State, const char * fun_name, Ret (T :: * Funny) (ARG ...)) {// ...} // ...};   

The compiler can not choose a second overload when a const function is passed as an indicator for the third argument in the form of a third surcharge, which should be a surcharge of < The code> const function can accept the member. It should be declared as follows:

  template & lt; typename ret, typename ... args & gt; Void _register_member (lua_State * state, const char * fun_name, ret (T :: * funny) (RGS ...) const ^^^^^   

chooses the compiler without such overload Is the first overload which is designed to work with pointers for data members (not a member of the function) and fails to compile its code.

So you can not work with members of the const function by using the current version of the Selena library (as if you minimized it We do).

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -