Skip to content
Snippets Groups Projects
Commit d4cde0f4 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[BL] try to fix type deduction

parent 74a30505
No related branches found
No related tags found
No related merge requests found
...@@ -169,11 +169,14 @@ struct FunctionTraits<ReturnType (Object::*)(Args...) const> { ...@@ -169,11 +169,14 @@ struct FunctionTraits<ReturnType (Object::*)(Args...) const> {
* This is in contrast to the behaviour of std::bind, and has been chosen in * This is in contrast to the behaviour of std::bind, and has been chosen in
* order to prevent accidental copies. * order to prevent accidental copies.
*/ */
template <typename Object, typename ReturnType, typename... Args> template <typename Object, typename MethodClass, typename ReturnType,
std::function<ReturnType(Args...)> easyBind( typename... Args>
ReturnType (std::remove_pointer<typename std::decay<Object>::type>::type::* typename std::enable_if<
method)(Args...), std::is_same<MethodClass,
Object&& obj) typename std::remove_cv<typename std::remove_pointer<
typename std::decay<Object>::type>::type>::type>::value,
std::function<ReturnType(Args...)>>::type
easyBind(ReturnType (MethodClass::*method)(Args...), Object&& obj)
{ {
return detail::easyBind_inner( return detail::easyBind_inner(
method, std::forward<Object>(obj), method, std::forward<Object>(obj),
...@@ -181,11 +184,14 @@ std::function<ReturnType(Args...)> easyBind( ...@@ -181,11 +184,14 @@ std::function<ReturnType(Args...)> easyBind(
} }
//! \overload //! \overload
template <typename Object, typename ReturnType, typename... Args> template <typename Object, typename MethodClass, typename ReturnType,
std::function<ReturnType(Args...)> easyBind( typename... Args>
ReturnType (std::remove_pointer<typename std::decay<Object>::type>::type::* typename std::enable_if<
method)(Args...) const, std::is_same<MethodClass,
Object&& obj) typename std::remove_cv<typename std::remove_pointer<
typename std::decay<Object>::type>::type>::type>::value,
std::function<ReturnType(Args...)>>::type
easyBind(ReturnType (MethodClass::*method)(Args...) const, Object&& obj)
{ {
return detail::easyBind_inner( return detail::easyBind_inner(
method, std::forward<Object>(obj), method, std::forward<Object>(obj),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment