File indexing completed on 2025-01-18 09:51:16
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/and.hpp>
0017 #include <boost/mpl/bool.hpp>
0018 #include <boost/cstdint.hpp>
0019
0020 namespace boost
0021 {
0022 namespace range_detail
0023 {
0024
0025 template<class T>
0026 class has_member_size_impl
0027 {
0028 private:
0029 template<class U, U>
0030 class check
0031 {
0032 };
0033
0034 template<class C>
0035 static boost::uint8_t f(check<std::size_t(C::*)(void) const, &C::size>*);
0036
0037 template<class C>
0038 static boost::uint16_t f(...);
0039
0040 public:
0041 static const bool value =
0042 (sizeof(f<T>(0)) == sizeof(boost::uint8_t));
0043
0044 typedef typename mpl::if_c<
0045 (sizeof(f<T>(0)) == sizeof(boost::uint8_t)),
0046 mpl::true_,
0047 mpl::false_
0048 >::type type;
0049 };
0050
0051 template<class T>
0052 struct has_member_size
0053 {
0054 typedef typename mpl::and_<
0055 typename is_class<T>::type,
0056 typename has_member_size_impl<const T>::type
0057 >::type type;
0058
0059 static const bool value =
0060 is_class<T>::value && has_member_size_impl<const T>::value;
0061 };
0062
0063 }
0064 }
0065
0066 #endif