Skip to content

Commit dc0d1eb

Browse files
committed
Fixed before C++17 workaround for is_invocable.
1 parent ffd3a74 commit dc0d1eb

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

include/mqtt/is_invocable.hpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,32 @@
88
#define MQTT_IS_INVOCABLE_HPP
99

1010
#include <type_traits>
11-
#include <boost/callable_traits.hpp>
12-
1311
#include <mqtt/namespace.hpp>
1412

15-
namespace MQTT_NS {
13+
#if __cplusplus >= 201703L
1614

17-
#if __cplusplus >= 201703L || defined(_MSC_VER)
15+
namespace MQTT_NS {
1816

1917
template <typename Func, typename... Params>
2018
using is_invocable = typename std::is_invocable<Func, Params...>;
2119

20+
} // namespace MQTT_NS
21+
2222
#else // __cplusplus >= 201703L
2323

24-
template <typename Func, typename... Params>
25-
using is_invocable = typename boost::callable_traits::is_invocable<Func, Params...>;
24+
#include <mqtt/move_only_function.hpp>
2625

27-
#endif // __cplusplus >= 201703L
26+
namespace MQTT_NS {
27+
28+
template <typename Func, typename... Params>
29+
struct is_invocable : std::is_constructible<
30+
move_only_function<void(Params...)>,
31+
std::reference_wrapper<typename std::remove_reference<Func>::type>
32+
>
33+
{};
2834

2935
} // namespace MQTT_NS
3036

37+
#endif // __cplusplus >= 201703L
38+
3139
#endif // MQTT_IS_INVOCABLE_HPP

0 commit comments

Comments
 (0)