From 2183de96a148ff692812fefcea32f5ce447bf198 Mon Sep 17 00:00:00 2001 From: Thomas Witt Date: Tue, 6 Jan 2004 19:44:06 +0000 Subject: [PATCH] Reverted unwanted checkin. [SVN r21520] --- include/boost/iterator/iterator_facade.hpp | 144 +++------------------ 1 file changed, 18 insertions(+), 126 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index bdc7eb3..79b2d3c 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -63,72 +63,6 @@ namespace boost #endif }; - // - // Determines the iterator type that can be - // safely used to implement binary operators - // - template < - class Facade1, - class Facade2 - > - struct interoperable_base - : mpl::if_< - is_convertible - , Facade2 - , Facade1 - > - { - }; - - template - struct difference_type - { - typedef typename interoperable_base::type::difference_type type; - }; - - template - bool equal(Facade1 const&, Facade2 const&); - - template - typename Facade1::difference_type distance_to(Facade1 const&, Facade2 const&); - - template - struct facade_binary_operator - { - template - static bool equal(Facade1 const& lhs, - Facade2 const& rhs) - { - return ::boost::detail::equal(lhs, rhs); - } - - template - static typename Facade1::difference_type distance_to(Facade1 const& lhs, - Facade2 const& rhs) - { - return ::boost::detail::distance_to(lhs, rhs); - } - }; - - template <> - struct facade_binary_operator - { - template - static bool equal(Facade1 const& lhs, - Facade2 const& rhs) - { - return ::boost::detail::equal(rhs, lhs); - } - - template - static typename Facade2::difference_type distance_to(Facade1 const& lhs, - Facade2 const& rhs) - { - return -::boost::detail::distance_to(rhs, lhs); - } - }; - - // // Generates associated types for an iterator_facade with the // given parameters. @@ -322,11 +256,9 @@ namespace boost BOOST_ITERATOR_FACADE_RELATION(>=) # undef BOOST_ITERATOR_FACADE_RELATION - template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > friend typename detail::enable_if_interoperable< Derived1, Derived2, typename std::iterator_traits ::type > ::difference_type > ::type operator -( iterator_facade const& lhs , iterator_facade const& rhs); - -// BOOST_ITERATOR_FACADE_INTEROP_HEAD( -// friend, -, (typename std::iterator_traits::type >::difference_type)) -// ; + BOOST_ITERATOR_FACADE_INTEROP_HEAD( + friend, -, typename Derived1::difference_type) + ; BOOST_ITERATOR_FACADE_PLUS_HEAD( friend @@ -365,7 +297,7 @@ namespace boost template static bool equal(Facade1 const& f1, Facade2 const& f2) { - return detail::facade_binary_operator< is_convertible< Facade2, Facade1 >::value >::equal(f1, f2); + return f1.equal(f2); } template @@ -375,51 +307,17 @@ namespace boost } template - static typename detail::difference_type::type distance_to( - Facade1 const& f1, Facade2 const& f2) - { - return detail::facade_binary_operator< is_convertible< Facade2, Facade1 >::value >::distance_to(f1, f2); - } - - private: - // objects of this class are useless - iterator_core_access(); //undefined - - // We would need template friends for these to be private - public: - template - static bool equal_fwd(Facade1 const& f1, Facade2 const& f2) - { - return f1.equal(f2); - } - - template - static typename Facade1::difference_type distance_to_fwd( + static typename Facade1::difference_type distance_to( Facade1 const& f1, Facade2 const& f2) { return f1.distance_to(f2); } + private: + // objects of this class are useless + iterator_core_access(); //undefined }; - namespace detail - { - - - template - bool equal(Facade1 const& f1, Facade2 const& f2) - { - return iterator_core_access::equal_fwd(f1, f2); - } - - template - typename Facade1::difference_type distance_to(Facade1 const& f1, Facade2 const& f2) - { - return iterator_core_access::distance_to_fwd(f1, f2); - } - - } - // // iterator_facade - use as a public base class for defining new // standard-conforming iterators. @@ -652,25 +550,19 @@ namespace boost BOOST_ITERATOR_FACADE_RELATION(>=, return 0 <=, distance_to) # undef BOOST_ITERATOR_FACADE_RELATION -// // operator- requires an additional part in the static assertion -// BOOST_ITERATOR_FACADE_INTEROP( -// - -// , typename Derived1::difference_type -// , (is_same< -// BOOST_DEDUCED_TYPENAME Derived1::difference_type -// , BOOST_DEDUCED_TYPENAME Derived2::difference_type -// >::value) -// , return - // , distance_to ) + // operator- requires an additional part in the static assertion + BOOST_ITERATOR_FACADE_INTEROP( + - + , typename Derived1::difference_type + , (is_same< + BOOST_DEDUCED_TYPENAME Derived1::difference_type + , BOOST_DEDUCED_TYPENAME Derived2::difference_type + >::value) + , return + , distance_to ) # undef BOOST_ITERATOR_FACADE_INTEROP # undef BOOST_ITERATOR_FACADE_INTEROP_HEAD - template < class Derived1, class V1, class TC1, class R1, class D1 , class Derived2, class V2, class TC2, class R2, class D2 > typename detail::enable_if_interoperable< Derived1, Derived2, typename std::iterator_traits ::type > ::difference_type > ::type operator -( iterator_facade const& lhs , iterator_facade const& rhs) - { - return iterator_core_access::distance_to(static_cast(rhs), static_cast(lhs)); - } - - # define BOOST_ITERATOR_FACADE_PLUS(args) \ BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \ { \