async_mqtt 5.0.0
Loading...
Searching...
No Matches
is_strand.hpp
1// Copyright Takatoshi Kondo 2022
2//
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#if !defined(ASYNC_MQTT_IS_STRAND_HPP)
8#define ASYNC_MQTT_IS_STRAND_HPP
9
10#include <type_traits>
11
12#include <boost/asio/strand.hpp>
13#include <boost/asio/io_context.hpp>
14
15namespace async_mqtt {
16
17namespace as = boost::asio;
18
19template <typename T>
20struct is_strand_template : std::false_type {};
21
22template <typename T>
23struct is_strand_template<as::strand<T>> : std::true_type {};
24
25template <typename T>
26constexpr bool is_strand() {
27 return
28 is_strand_template<T>::value ||
29 std::is_same_v<T, as::io_context::strand>;
30}
31
32} // namespace async_mqtt
33
34#endif // ASYNC_MQTT_IS_STRAND_HPP