File indexing completed on 2025-01-18 09:43:37
0001
0002
0003
0004
0005
0006 #ifndef BOOST_PFR_DETAIL_DETECTORS_HPP
0007 #define BOOST_PFR_DETAIL_DETECTORS_HPP
0008 #pragma once
0009
0010 #include <boost/pfr/detail/config.hpp>
0011
0012 #include <functional>
0013 #include <type_traits>
0014
0015 namespace boost { namespace pfr { namespace detail {
0016
0017 struct can_not_apply{};
0018
0019 template <template <class, class> class Detector, class Tleft, class Tright>
0020 struct not_appliable {
0021 static constexpr bool value = std::is_same<
0022 Detector<Tleft, Tright>,
0023 can_not_apply
0024 >::value;
0025 };
0026
0027
0028 template <class S, class T> auto comp_eq_detector_msvc_helper(long) -> decltype(std::declval<S>() == std::declval<T>());
0029 template <class S, class T> can_not_apply comp_eq_detector_msvc_helper(int);
0030 template <class T1, class T2> using comp_eq_detector = decltype(comp_eq_detector_msvc_helper<T1,T2>(1L));
0031
0032 template <class S, class T> auto comp_ne_detector_msvc_helper(long) -> decltype(std::declval<S>() != std::declval<T>());
0033 template <class S, class T> can_not_apply comp_ne_detector_msvc_helper(int);
0034 template <class T1, class T2> using comp_ne_detector = decltype(comp_ne_detector_msvc_helper<T1,T2>(1L));
0035
0036 template <class S, class T> auto comp_lt_detector_msvc_helper(long) -> decltype(std::declval<S>() < std::declval<T>());
0037 template <class S, class T> can_not_apply comp_lt_detector_msvc_helper(int);
0038 template <class T1, class T2> using comp_lt_detector = decltype(comp_lt_detector_msvc_helper<T1,T2>(1L));
0039
0040 template <class S, class T> auto comp_le_detector_msvc_helper(long) -> decltype(std::declval<S>() <= std::declval<T>());
0041 template <class S, class T> can_not_apply comp_le_detector_msvc_helper(int);
0042 template <class T1, class T2> using comp_le_detector = decltype(comp_le_detector_msvc_helper<T1,T2>(1L));
0043
0044 template <class S, class T> auto comp_gt_detector_msvc_helper(long) -> decltype(std::declval<S>() > std::declval<T>());
0045 template <class S, class T> can_not_apply comp_gt_detector_msvc_helper(int);
0046 template <class T1, class T2> using comp_gt_detector = decltype(comp_gt_detector_msvc_helper<T1,T2>(1L));
0047
0048 template <class S, class T> auto comp_ge_detector_msvc_helper(long) -> decltype(std::declval<S>() >= std::declval<T>());
0049 template <class S, class T> can_not_apply comp_ge_detector_msvc_helper(int);
0050 template <class T1, class T2> using comp_ge_detector = decltype(comp_ge_detector_msvc_helper<T1,T2>(1L));
0051
0052
0053 template <class S> auto hash_detector_msvc_helper(long) -> decltype(std::hash<S>{}(std::declval<S>()));
0054 template <class S> can_not_apply hash_detector_msvc_helper(int);
0055 template <class T1, class T2> using hash_detector = decltype(hash_detector_msvc_helper<T1,T2>(1L));
0056
0057
0058 template <class S, class T> auto ostreamable_detector_msvc_helper(long) -> decltype(std::declval<S>() << std::declval<T>());
0059 template <class S, class T> can_not_apply ostreamable_detector_msvc_helper(int);
0060 template <class S, class T> using ostreamable_detector = decltype(ostreamable_detector_msvc_helper<S,T>(1L));
0061
0062 template <class S, class T> auto istreamable_detector_msvc_helper(long) -> decltype(std::declval<S>() >> std::declval<T>());
0063 template <class S, class T> can_not_apply istreamable_detector_msvc_helper(int);
0064 template <class S, class T> using istreamable_detector = decltype(istreamable_detector_msvc_helper<S,T>(1L));
0065
0066 }}}
0067
0068 #endif
0069
0070