3 // Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_SIZE_TYPE_HPP
12 #define BOOST_RANGE_SIZE_TYPE_HPP
18 #include <boost/range/config.hpp>
19 #include <boost/range/difference_type.hpp>
20 #include <boost/range/concepts.hpp>
21 #include <boost/range/has_range_iterator.hpp>
23 #include <boost/utility/enable_if.hpp>
24 #include <boost/type_traits/make_unsigned.hpp>
25 #include <boost/type_traits/remove_const.hpp>
34 //////////////////////////////////////////////////////////////////////////
36 //////////////////////////////////////////////////////////////////////////
42 struct yes_type { char dummy[2]; };
45 static yes_type test(BOOST_DEDUCED_TYPENAME C::size_type x);
48 static no_type test(...);
51 static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
54 template<typename C, typename Enabler=void>
57 typedef BOOST_DEDUCED_TYPENAME make_unsigned<
58 BOOST_DEDUCED_TYPENAME range_difference<C>::type
65 BOOST_DEDUCED_TYPENAME ::boost::enable_if<has_size_type<C>, void>::type
68 typedef BOOST_DEDUCED_TYPENAME C::size_type type;
71 template<typename C, bool B = range_detail::has_type< range_iterator<C> >::value>
76 struct range_size<C, true>
87 struct range_size<const T > :