X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=boost%2Fiterator%2Fiterator_adaptor.hpp;h=87cfd0583fcb21bdfa0cf629075849368d04dd35;hb=08c1e93fa36a49f49325a07fe91ff92c964c2b6c;hp=9f2fbb0efef15d723abaed46d055a7a70419fc76;hpb=bb4dd8289b351fae6b55e303f189127a394a1edd;p=platform%2Fupstream%2Fboost.git diff --git a/boost/iterator/iterator_adaptor.hpp b/boost/iterator/iterator_adaptor.hpp index 9f2fbb0..87cfd05 100644 --- a/boost/iterator/iterator_adaptor.hpp +++ b/boost/iterator/iterator_adaptor.hpp @@ -31,28 +31,33 @@ #include -namespace boost -{ +namespace boost { +namespace iterators { + // Used as a default template argument internally, merely to // indicate "use the default", this can also be passed by users // explicitly in order to specify that the default should be used. struct use_default; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // the incompleteness of use_default causes massive problems for - // is_convertible (naturally). This workaround is fortunately not - // needed for vc6/vc7. - template - struct is_convertible - : mpl::false_ {}; -# endif - + +} // namespace iterators + +using iterators::use_default; + +// the incompleteness of use_default causes massive problems for +// is_convertible (naturally). This workaround is fortunately not +// needed for vc6/vc7. +template +struct is_convertible + : mpl::false_ {}; + +namespace iterators { + namespace detail { - // + // // Result type used in enable_if_convertible meta function. - // This can be an incomplete type, as only pointers to + // This can be an incomplete type, as only pointers to // enable_if_convertible< ... >::type are used. // We could have used void for this, but conversion to // void* is just to easy. @@ -73,7 +78,7 @@ namespace boost // public iterator_adaptor< adapted_iterator, Iterator > // { // public: - // + // // ... // // template @@ -92,38 +97,23 @@ namespace boost // and not at the actual instantiation. // // enable_if_interoperable can be safely used in user code. It falls back to - // always enabled for compilers that don't support enable_if or is_convertible. - // There is no need for compiler specific workarounds in user code. + // always enabled for compilers that don't support enable_if or is_convertible. + // There is no need for compiler specific workarounds in user code. // // The operators implementation relies on boost::is_convertible not returning // false positives for user/library defined iterator types. See comments // on operator implementation for consequences. // -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - - template - struct enable_if_convertible - { - typedef typename mpl::if_< - mpl::or_< - is_same - , is_convertible - > - , boost::detail::enable_type - , int& - >::type type; - }; - -# elif defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) - +# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) + template struct enable_if_convertible { - typedef boost::detail::enable_type type; + typedef boost::iterators::detail::enable_type type; }; - -# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300 - + +# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) + // For some reason vc7.1 needs us to "cut off" instantiation // of is_convertible in a few cases. template @@ -133,22 +123,22 @@ namespace boost is_same , is_convertible > - , boost::detail::enable_type + , boost::iterators::detail::enable_type > {}; - -# else - + +# else + template struct enable_if_convertible : iterators::enable_if< is_convertible - , boost::detail::enable_type + , boost::iterators::detail::enable_type > {}; - + # endif - + // // Default template argument handling for iterator_adaptor // @@ -180,9 +170,9 @@ namespace boost { typedef iterator_facade< Derived - + # ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY - , typename boost::detail::ia_dflt_help< + , typename boost::iterators::detail::ia_dflt_help< Value , mpl::eval_if< is_same @@ -191,17 +181,17 @@ namespace boost > >::type # else - , typename boost::detail::ia_dflt_help< + , typename boost::iterators::detail::ia_dflt_help< Value, iterator_value >::type # endif - - , typename boost::detail::ia_dflt_help< + + , typename boost::iterators::detail::ia_dflt_help< Traversal , iterator_traversal >::type - , typename boost::detail::ia_dflt_help< + , typename boost::iterators::detail::ia_dflt_help< Reference , mpl::eval_if< is_same @@ -210,13 +200,13 @@ namespace boost > >::type - , typename boost::detail::ia_dflt_help< + , typename boost::iterators::detail::ia_dflt_help< Difference, iterator_difference >::type > type; }; - + // workaround for aC++ CR JAGaf33512 template inline void iterator_adaptor_assert_traversal () @@ -224,7 +214,7 @@ namespace boost BOOST_STATIC_ASSERT((is_convertible::value)); } } - + // // Iterator Adaptor // @@ -259,14 +249,14 @@ namespace boost , class Difference = use_default > class iterator_adaptor - : public boost::detail::iterator_adaptor_base< + : public boost::iterators::detail::iterator_adaptor_base< Derived, Base, Value, Traversal, Reference, Difference >::type { friend class iterator_core_access; protected: - typedef typename boost::detail::iterator_adaptor_base< + typedef typename boost::iterators::detail::iterator_adaptor_base< Derived, Base, Value, Traversal, Reference, Difference >::type super_t; public: @@ -285,7 +275,7 @@ namespace boost protected: // for convenience in derived classes typedef iterator_adaptor iterator_adaptor_; - + // // lvalue access to the Base object for Derived // @@ -301,13 +291,13 @@ namespace boost // to prevent temptation for Derived classes to use it, which // will often result in an error. Derived classes should use // base_reference(), above, to get direct access to m_iterator. - // + // typename super_t::reference dereference() const { return *m_iterator; } template < class OtherDerived, class OtherIterator, class V, class C, class R, class D - > + > bool equal(iterator_adaptor const& x) const { // Maybe readd with same_distance @@ -322,17 +312,17 @@ namespace boost >::type my_traversal; # define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ - boost::detail::iterator_adaptor_assert_traversal(); + boost::iterators::detail::iterator_adaptor_assert_traversal(); void advance(typename super_t::difference_type n) { BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) m_iterator += n; } - + void increment() { ++m_iterator; } - void decrement() + void decrement() { BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag) --m_iterator; @@ -340,7 +330,7 @@ namespace boost template < class OtherDerived, class OtherIterator, class V, class C, class R, class D - > + > typename super_t::difference_type distance_to( iterator_adaptor const& y) const { @@ -353,11 +343,16 @@ namespace boost } # undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL - + private: // data members Base m_iterator; }; +} // namespace iterators + +using iterators::iterator_adaptor; +using iterators::enable_if_convertible; + } // namespace boost #include