Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:38:19

0001 //
0002 // Copyright (c) 2023-2025 Ivica Siladic, Bruno Iljazovic, Korina Simicevic
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MQTT5_TRAITS_HPP
0009 #define BOOST_MQTT5_TRAITS_HPP
0010 
0011 #include <boost/container/small_vector.hpp>
0012 #include <boost/range/iterator_range_core.hpp>
0013 #include <boost/type_traits/remove_cv_ref.hpp>
0014 
0015 #include <optional>
0016 #include <utility>
0017 #include <vector>
0018 
0019 namespace boost::mqtt5::detail {
0020 
0021 template <typename>
0022 constexpr bool is_optional_impl = false;
0023 
0024 template <typename T>
0025 constexpr bool is_optional_impl<std::optional<T>> = true;
0026 
0027 template <typename T>
0028 constexpr bool is_optional = is_optional_impl<boost::remove_cv_ref_t<T>>;
0029 
0030 template <typename, template <typename...> typename>
0031 constexpr bool is_specialization = false;
0032 
0033 template <template <typename...> typename T, typename... Args>
0034 constexpr bool is_specialization<T<Args...>, T> = true;
0035 
0036 template <typename T>
0037 constexpr bool is_vector = is_specialization<
0038     boost::remove_cv_ref_t<T>, std::vector
0039 >;
0040 
0041 template <typename... Args>
0042 constexpr std::true_type is_small_vector_impl(
0043     boost::container::small_vector_base<Args...> const &
0044 );
0045 constexpr std::false_type is_small_vector_impl( ... );
0046 
0047 template <typename T>
0048 constexpr bool is_small_vector =
0049     decltype(is_small_vector_impl(std::declval<T>()))::value;
0050 
0051 template <typename T>
0052 constexpr bool is_pair = is_specialization<
0053     boost::remove_cv_ref_t<T>, std::pair
0054 >;
0055 
0056 template <typename T>
0057 constexpr bool is_boost_iterator = is_specialization<
0058     boost::remove_cv_ref_t<T>, boost::iterator_range
0059 >;
0060 
0061 } // end namespace boost::mqtt5::detail
0062 
0063 #endif // !BOOST_MQTT5_TRAITS_HPP