add support for const ref params and fix bugs with implict variant conversion
This commit is contained in:
parent
74b707999c
commit
94faa4e362
2 changed files with 4 additions and 3 deletions
|
|
@ -58,7 +58,7 @@ namespace fc {
|
||||||
R call_generic( const std::function<R(Arg0,Args...)>& f, variants::const_iterator a0, variants::const_iterator e )const
|
R call_generic( const std::function<R(Arg0,Args...)>& f, variants::const_iterator a0, variants::const_iterator e )const
|
||||||
{
|
{
|
||||||
FC_ASSERT( a0 != e );
|
FC_ASSERT( a0 != e );
|
||||||
return call_generic<R,Args...>( bind_first_arg( f, a0->as<Arg0>() ), a0+1, e );
|
return call_generic<R,Args...>( bind_first_arg<R,Arg0,Args...>( f, a0->as< typename std::decay<Arg0>::type >() ), a0+1, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Interface, typename Adaptor, typename ... Args>
|
template<typename Interface, typename Adaptor, typename ... Args>
|
||||||
|
|
@ -71,7 +71,7 @@ namespace fc {
|
||||||
std::function<variant(const fc::variants&)> to_generic( const std::function<R(Args...)>& f )const
|
std::function<variant(const fc::variants&)> to_generic( const std::function<R(Args...)>& f )const
|
||||||
{
|
{
|
||||||
return [=]( const variants& args ) {
|
return [=]( const variants& args ) {
|
||||||
return call_generic( f, args.begin(), args.end() );
|
return variant( call_generic( f, args.begin(), args.end() ) );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@ class login_api
|
||||||
return *calc;
|
return *calc;
|
||||||
}
|
}
|
||||||
fc::optional<fc::api<calculator>> calc;
|
fc::optional<fc::api<calculator>> calc;
|
||||||
|
std::set<std::string> test( const std::string&, const std::string& ){};
|
||||||
};
|
};
|
||||||
FC_API( login_api, (get_calc) );
|
FC_API( login_api, (get_calc)(test) );
|
||||||
|
|
||||||
using namespace fc;
|
using namespace fc;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue