18#ifndef IOX_HOOFS_CXX_TYPE_TRAITS_HPP
19#define IOX_HOOFS_CXX_TYPE_TRAITS_HPP
32template <
typename T,
typename C>
37template <
typename T,
typename C>
45template <
typename T,
typename C>
46using add_const_conditionally_t =
typename add_const_conditionally<T, C>::type;
55constexpr bool always_false_v =
false;
58#if __cplusplus < 201703L && !defined(_WIN32)
59template <
typename C,
typename... Cargs>
60using invoke_result = std::result_of<C(Cargs...)>;
61#elif __cplusplus >= 201703L || defined(_WIN32)
62template <
typename C,
typename... Cargs>
63using invoke_result = std::invoke_result<C, Cargs...>;
69template <
typename Callable,
typename... ArgTypes>
74 template <
typename C,
typename... As>
75 static constexpr std::true_type
test(
typename cxx::invoke_result<C, As...>::type*)
noexcept
81 template <
typename C,
typename... As>
82 static constexpr std::false_type
test(...) noexcept
88 static constexpr bool value =
decltype(
test<Callable, ArgTypes...>(
nullptr))::value;
97template <
typename ReturnType,
typename Callable,
typename... ArgTypes>
100 template <
typename C,
typename... As>
101 static constexpr std::true_type test(
102 std::enable_if_t<std::is_convertible<
typename cxx::invoke_result<C, As...>::type, ReturnType>::value>*)
noexcept
107 template <
typename C,
typename... As>
108 static constexpr std::false_type test(...)
noexcept
114 static constexpr bool value =
decltype(test<Callable, ArgTypes...>(
nullptr))::value;
124template <
typename ReturnType,
typename... ArgTypes>
130template <
typename...>
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:29
Conditionally add const to type T if C has the const qualifier.
Definition: type_traits.hpp:34
Check whether T is a function pointer with arbitrary signature.
Definition: type_traits.hpp:122
Verifies whether the passed Callable type is in fact invocable with the given arguments and the resul...
Definition: type_traits.hpp:99
Verifies whether the passed Callable type is in fact invocable with the given arguments.
Definition: type_traits.hpp:71
static constexpr std::true_type test(typename cxx::invoke_result< C, As... >::type *) noexcept
Definition: type_traits.hpp:75