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> {
* This is in contrast to the behaviour of std::bind, and has been chosen in
* order to prevent accidental copies.
*/
template <typename Object, typename ReturnType, typename... Args>
std::function<ReturnType(Args...)> easyBind(
ReturnType (std::remove_pointer<typename std::decay<Object>::type>::type::*
method)(Args...),
Object&& obj)
template <typename Object, typename MethodClass, typename ReturnType,
typename... Args>
typename std::enable_if<
std::is_same<MethodClass,
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(
method, std::forward<Object>(obj),
......@@ -181,11 +184,14 @@ std::function<ReturnType(Args...)> easyBind(
}
//! \overload
template <typename Object, typename ReturnType, typename... Args>
std::function<ReturnType(Args...)> easyBind(
ReturnType (std::remove_pointer<typename std::decay<Object>::type>::type::*
method)(Args...) const,
Object&& obj)
template <typename Object, typename MethodClass, typename ReturnType,
typename... Args>
typename std::enable_if<
std::is_same<MethodClass,
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(
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