Skip to content

Commit

Permalink
iox-eclipse-iceoryx#391 fixed function_ref constructor enable_if cond…
Browse files Browse the repository at this point in the history
…ition

Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
  • Loading branch information
MatthiasKillat committed May 21, 2021
1 parent 7c4a4fc commit e0f87ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion iceoryx_hoofs/include/iceoryx_hoofs/cxx/function_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ class function_ref<ReturnType(ArgTypes...)>
{
using SignatureType = ReturnType(ArgTypes...);

template <typename T1, typename T2>
using has_same_decayed_type = typename std::integral_constant<
bool,
bool(std::is_same<typename std::decay<T1>::type, typename std::decay<T2>::type>::value)>;

public:
/// @brief Creates an empty function_ref in an invalid state
/// @note Handle with care, program will terminate when calling an invalid function_ref
Expand All @@ -89,7 +94,7 @@ class function_ref<ReturnType(ArgTypes...)>
/// @param[in] callable that is not a function_ref
template <typename CallableType,
typename = std::enable_if_t<!is_function_pointer<CallableType>::value
&& !std::is_same<CallableType, function_ref>::value
&& !has_same_decayed_type<CallableType, function_ref>::value
&& is_invocable<CallableType, ArgTypes...>::value>>
function_ref(CallableType&& callable) noexcept;

Expand Down

0 comments on commit e0f87ce

Please sign in to comment.