Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function object cannot bind right? #35

Closed
ThePhD opened this issue Jul 11, 2016 · 2 comments
Closed

function object cannot bind right? #35

ThePhD opened this issue Jul 11, 2016 · 2 comments

Comments

@ThePhD
Copy link

ThePhD commented Jul 11, 2016

Visua Studio 2015, Update 3, latest Kaguya

struct func_obj {
     int x;
     int operator()( int i ) { x = i; return i; }
};

int main (int argc, char*[] argv ) {
     kaguya::State state;
     // Fails Line 408, native_function.hpp
     // is_callable KAGUYA_STATIC_ASSERT assertion
     //state["f"] = kaguya::function( func_obj() );

     // works fine
     state["f"] = kaguya::function( [](int i){ func_obj o; return o(i); } );

     // also fine
     func_obj fo; 
     state["f"] = kaguya::function( [&](int i){ return fo(i); } );
}

Is something wrong with is_callable trait?

@ThePhD
Copy link
Author

ThePhD commented Jul 11, 2016

Can fix with:

native_function_cxx11.hpp, line 99, add specialization for non-const function:

template <typename T, typename Ret, typename... Args>
struct functor_f_signature<Ret(T::*)(Args...)> {
    typedef invoke_signature_type<Ret, Args...> type;
};

@satoren
Copy link
Owner

satoren commented Jul 12, 2016

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants