Skip to content

Commit 1838029

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

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

include/mqtt/is_invocable.hpp

+15-6
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,33 @@
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 {
1613

1714
#if __cplusplus >= 201703L || defined(_MSC_VER)
1815

16+
namespace MQTT_NS {
17+
1918
template <typename Func, typename... Params>
2019
using is_invocable = typename std::is_invocable<Func, Params...>;
2120

21+
} // namespace MQTT_NS
22+
2223
#else // __cplusplus >= 201703L
2324

24-
template <typename Func, typename... Params>
25-
using is_invocable = typename boost::callable_traits::is_invocable<Func, Params...>;
25+
#include <functional>
2626

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

2936
} // namespace MQTT_NS
3037

38+
#endif // __cplusplus >= 201703L
39+
3140
#endif // MQTT_IS_INVOCABLE_HPP

0 commit comments

Comments
 (0)