diff --git a/include/boost/range/difference_type.hpp b/include/boost/range/difference_type.hpp index afd8b07..a244908 100644 --- a/include/boost/range/difference_type.hpp +++ b/include/boost/range/difference_type.hpp @@ -15,20 +15,37 @@ # pragma once #endif +#include #include #include +#include #include #include namespace boost { + namespace range_detail + { + template< class T, class Enabler=void > + struct range_difference + { }; + + template< class T > + struct range_difference< + T, + BOOST_DEDUCED_TYPENAME ::boost::enable_if_c< + has_type >::value + >::type + > + : iterator_difference< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + { }; + } + template< class T > struct range_difference - : iterator_difference< - BOOST_DEDUCED_TYPENAME range_iterator< - BOOST_DEDUCED_TYPENAME remove_reference::type - >::type - > + : range_detail::range_difference::type> { }; } diff --git a/include/boost/range/iterator.hpp b/include/boost/range/iterator.hpp index f15bf3b..2956353 100644 --- a/include/boost/range/iterator.hpp +++ b/include/boost/range/iterator.hpp @@ -46,31 +46,29 @@ namespace boost }; } -#endif - template< typename C, typename Enabler=void > struct range_iterator { -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) - + typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail_vc7_1::range_iterator::type type; - -#else - private: - typedef typename remove_reference::type param_t; - - public: - typedef typename mpl::eval_if_c< - is_const::value, - range_const_iterator::type>, - range_mutable_iterator - >::type type; - -#endif }; - + +#else + + template< typename C, typename Enabler=void > + struct range_iterator + : mpl::if_c< + is_const::type>::value, + range_const_iterator::type>::type>, + range_mutable_iterator::type> + >::type + { + }; + +#endif + } // namespace boost #endif diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp index db5a59b..0b45f4c 100644 --- a/include/boost/range/size_type.hpp +++ b/include/boost/range/size_type.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -51,7 +52,7 @@ namespace boost }; template - struct range_size + struct range_size_ { typedef BOOST_DEDUCED_TYPENAME make_unsigned< BOOST_DEDUCED_TYPENAME range_difference::type @@ -59,7 +60,7 @@ namespace boost }; template - struct range_size< + struct range_size_< C, BOOST_DEDUCED_TYPENAME ::boost::enable_if, void>::type > @@ -67,29 +68,38 @@ namespace boost typedef BOOST_DEDUCED_TYPENAME C::size_type type; }; - } + template + struct range_size + { }; - template< class T > - struct range_size : - detail::range_size - { + template + struct range_size< + C, + BOOST_DEDUCED_TYPENAME ::boost::enable_if_c< + range_detail::has_type< range_iterator >::value + >::type + > + : 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)); + 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 - }; + struct range_size : + detail::range_size + { }; + + template< class T > + struct range_size : + detail::range_size + { }; } // namespace boost