3 // Copyright Neil Groves 2014.
5 // Use, modification and distribution are subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt).
9 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
12 #define BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
14 #include <boost/type_traits/is_class.hpp>
15 #include <boost/type_traits/is_member_function_pointer.hpp>
16 #include <boost/mpl/and.hpp>
17 #include <boost/mpl/bool.hpp>
18 #include <boost/cstdint.hpp>
22 namespace range_detail
26 class has_member_size_impl
35 static boost::uint8_t f(check<std::size_t(C::*)(void) const, &C::size>*);
38 static boost::uint16_t f(...);
41 static const bool value =
42 (sizeof(f<T>(0)) == sizeof(boost::uint8_t));
44 typedef typename mpl::if_c<
45 (sizeof(f<T>(0)) == sizeof(boost::uint8_t)),
52 struct has_member_size
54 typedef typename mpl::and_<
55 typename is_class<T>::type,
56 typename has_member_size_impl<const T>::type
59 static const bool value =
60 is_class<T>::value && has_member_size_impl<const T>::value;
63 } // namespace range_detail
66 #endif // include guard