File indexing completed on 2025-01-18 09:42:24
0001
0002
0003
0004
0005
0006 #ifndef BOOST_IS_BYTE_CONTAINER_HPP
0007 #define BOOST_IS_BYTE_CONTAINER_HPP
0008
0009 #include <iterator>
0010 #include <type_traits>
0011
0012 namespace boost { namespace multiprecision { namespace detail {
0013
0014 template <class T>
0015 struct has_member_const_iterator
0016 {
0017 template <class U>
0018 static double check(U*, typename U::const_iterator* = nullptr);
0019 static char check(...);
0020 static T* get();
0021 static constexpr bool value = sizeof(check(get())) == sizeof(double);
0022 };
0023
0024
0025 template <class C, class Iterator>
0026 struct is_byte_container_imp_2
0027 {
0028 using container_value_type = typename std::remove_cv<typename std::iterator_traits<typename C::const_iterator>::value_type>::type;
0029 static constexpr bool value = boost::multiprecision::detail::is_integral<container_value_type>::value && (sizeof(container_value_type) == 1);
0030 };
0031
0032 template <class C>
0033 struct is_byte_container_imp_2<C, void> : public std::false_type
0034 {};
0035
0036 template <class C, bool b>
0037 struct is_byte_container_imp : public is_byte_container_imp_2<C, typename C::const_iterator>
0038 {
0039 };
0040
0041 template <class C>
0042 struct is_byte_container_imp<C, false> : public std::false_type
0043 {};
0044
0045 template <class C>
0046 struct is_byte_container : public is_byte_container_imp<C, has_member_const_iterator<C>::value>
0047 {};
0048
0049 }}}
0050
0051 #endif