// Boost.Range library // // Copyright Thorsten Ottosen 2003-2004. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // For more information, see http://www.boost.org/libs/range/ // #ifndef BOOST_RANGE_SIZE_TYPE_HPP #define BOOST_RANGE_SIZE_TYPE_HPP #if defined(_MSC_VER) # pragma once #endif #include #include #include #include #include #include #include #include namespace boost { namespace detail { ////////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////////// template class has_size_type { typedef char no_type; struct yes_type { char dummy[2]; }; template static yes_type test(BOOST_DEDUCED_TYPENAME C::size_type x); template static no_type test(...); public: static const bool value = sizeof(test(0)) == sizeof(yes_type); }; template struct range_size { typedef BOOST_DEDUCED_TYPENAME make_unsigned< BOOST_DEDUCED_TYPENAME range_difference::type >::type type; }; template struct range_size< C, BOOST_DEDUCED_TYPENAME ::boost::enable_if, void>::type > { typedef BOOST_DEDUCED_TYPENAME C::size_type type; }; } template< class T > struct range_size : detail::range_size { // Very strange things happen on some compilers that have the range concept // asserts disabled. This preprocessor condition is clearly redundant on a // working compiler but is vital for at least some compilers such as clang 4.2 // but only on the Mac! #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1 BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept)); #endif }; template< class T > struct range_size : detail::range_size { #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1 BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept)); #endif }; } // namespace boost #endif