File indexing completed on 2025-09-15 08:51:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
0012 #define BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
0013
0014 #include <boost/type_traits/is_class.hpp>
0015 #include <boost/type_traits/is_member_function_pointer.hpp>
0016 #include <boost/mpl/if.hpp>
0017 #include <boost/mpl/and.hpp>
0018 #include <boost/mpl/bool.hpp>
0019 #include <boost/cstdint.hpp>
0020
0021 namespace boost
0022 {
0023 namespace range_detail
0024 {
0025
0026 template<class T>
0027 class has_member_size_impl
0028 {
0029 private:
0030 template<class U, U>
0031 class check
0032 {
0033 };
0034
0035 template<class C>
0036 static boost::uint8_t f(check<std::size_t(C::*)(void) const, &C::size>*);
0037
0038 template<class C>
0039 static boost::uint16_t f(...);
0040
0041 public:
0042 static const bool value =
0043 (sizeof(f<T>(0)) == sizeof(boost::uint8_t));
0044
0045 typedef typename mpl::if_c<
0046 (sizeof(f<T>(0)) == sizeof(boost::uint8_t)),
0047 mpl::true_,
0048 mpl::false_
0049 >::type type;
0050 };
0051
0052 template<class T>
0053 struct has_member_size
0054 {
0055 typedef typename mpl::and_<
0056 typename is_class<T>::type,
0057 typename has_member_size_impl<const T>::type
0058 >::type type;
0059
0060 static const bool value =
0061 is_class<T>::value && has_member_size_impl<const T>::value;
0062 };
0063
0064 }
0065 }
0066
0067 #endif