epoc32/include/stdapis/boost/iterator/indirect_iterator.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/iterator/indirect_iterator.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,139 @@
     1.4 +// (C) Copyright David Abrahams 2002.
     1.5 +// (C) Copyright Jeremy Siek    2002.
     1.6 +// (C) Copyright Thomas Witt    2002.
     1.7 +// Distributed under the Boost Software License, Version 1.0. (See
     1.8 +// accompanying file LICENSE_1_0.txt or copy at
     1.9 +// http://www.boost.org/LICENSE_1_0.txt)
    1.10 +#ifndef BOOST_INDIRECT_ITERATOR_23022003THW_HPP
    1.11 +#define BOOST_INDIRECT_ITERATOR_23022003THW_HPP
    1.12 +
    1.13 +#include <boost/iterator.hpp>
    1.14 +#include <boost/iterator/iterator_adaptor.hpp>
    1.15 +
    1.16 +#include <boost/pointee.hpp>
    1.17 +#include <boost/indirect_reference.hpp>
    1.18 +#include <boost/detail/iterator.hpp>
    1.19 +
    1.20 +#include <boost/detail/indirect_traits.hpp>
    1.21 +
    1.22 +#include <boost/type_traits/is_same.hpp>
    1.23 +#include <boost/type_traits/add_reference.hpp>
    1.24 +
    1.25 +#include <boost/mpl/bool.hpp>
    1.26 +#include <boost/mpl/identity.hpp>
    1.27 +#include <boost/mpl/eval_if.hpp>
    1.28 +#include <boost/mpl/not.hpp>
    1.29 +#include <boost/mpl/has_xxx.hpp>
    1.30 +
    1.31 +#ifdef BOOST_MPL_CFG_NO_HAS_XXX
    1.32 +# include <boost/shared_ptr.hpp>
    1.33 +# include <boost/scoped_ptr.hpp>
    1.34 +# include <boost/mpl/bool.hpp>
    1.35 +# include <memory>
    1.36 +#endif 
    1.37 +
    1.38 +#include <boost/iterator/detail/config_def.hpp> // must be last #include
    1.39 +
    1.40 +namespace boost
    1.41 +{
    1.42 +  template <class Iter, class Value, class Category, class Reference, class Difference>
    1.43 +  class indirect_iterator;
    1.44 +
    1.45 +  namespace detail
    1.46 +  {
    1.47 +    template <class Iter, class Value, class Category, class Reference, class Difference>
    1.48 +    struct indirect_base
    1.49 +    {
    1.50 +        typedef typename iterator_traits<Iter>::value_type dereferenceable;
    1.51 +        
    1.52 +        typedef iterator_adaptor<
    1.53 +            indirect_iterator<Iter, Value, Category, Reference, Difference>
    1.54 +          , Iter
    1.55 +          , typename ia_dflt_help<
    1.56 +                Value, pointee<dereferenceable>
    1.57 +            >::type
    1.58 +          , Category
    1.59 +          , typename ia_dflt_help<
    1.60 +                Reference
    1.61 +              , mpl::eval_if<
    1.62 +                    is_same<Value,use_default>
    1.63 +                  , indirect_reference<dereferenceable>
    1.64 +                  , add_reference<Value>
    1.65 +                >
    1.66 +            >::type
    1.67 +          , Difference
    1.68 +        > type;
    1.69 +    };
    1.70 +
    1.71 +    template <>
    1.72 +    struct indirect_base<int, int, int, int, int> {};
    1.73 +  } // namespace detail
    1.74 +
    1.75 +    
    1.76 +  template <
    1.77 +      class Iterator
    1.78 +    , class Value = use_default
    1.79 +    , class Category = use_default
    1.80 +    , class Reference = use_default
    1.81 +    , class Difference = use_default
    1.82 +  >
    1.83 +  class indirect_iterator
    1.84 +    : public detail::indirect_base<
    1.85 +        Iterator, Value, Category, Reference, Difference
    1.86 +      >::type
    1.87 +  {
    1.88 +      typedef typename detail::indirect_base<
    1.89 +          Iterator, Value, Category, Reference, Difference
    1.90 +      >::type super_t;
    1.91 +
    1.92 +      friend class iterator_core_access;
    1.93 +
    1.94 +   public:
    1.95 +      indirect_iterator() {}
    1.96 +
    1.97 +      indirect_iterator(Iterator iter)
    1.98 +        : super_t(iter) {}
    1.99 +
   1.100 +      template <
   1.101 +          class Iterator2, class Value2, class Category2
   1.102 +        , class Reference2, class Difference2
   1.103 +      >
   1.104 +      indirect_iterator(
   1.105 +          indirect_iterator<
   1.106 +               Iterator2, Value2, Category2, Reference2, Difference2
   1.107 +          > const& y
   1.108 +        , typename enable_if_convertible<Iterator2, Iterator>::type* = 0
   1.109 +      )
   1.110 +        : super_t(y.base())
   1.111 +      {}
   1.112 +
   1.113 +  private:    
   1.114 +      typename super_t::reference dereference() const
   1.115 +      {
   1.116 +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
   1.117 +          return const_cast<super_t::reference>(**this->base());
   1.118 +# else
   1.119 +          return **this->base();
   1.120 +# endif 
   1.121 +      }
   1.122 +  };
   1.123 +
   1.124 +  template <class Iter>
   1.125 +  inline
   1.126 +  indirect_iterator<Iter> make_indirect_iterator(Iter x)
   1.127 +  {
   1.128 +    return indirect_iterator<Iter>(x);
   1.129 +  }
   1.130 +
   1.131 +  template <class Traits, class Iter>
   1.132 +  inline
   1.133 +  indirect_iterator<Iter,Traits> make_indirect_iterator(Iter x, Traits* = 0)
   1.134 +  {
   1.135 +    return indirect_iterator<Iter, Traits>(x);
   1.136 +  }
   1.137 +
   1.138 +} // namespace boost
   1.139 +
   1.140 +#include <boost/iterator/detail/config_undef.hpp>
   1.141 +
   1.142 +#endif // BOOST_INDIRECT_ITERATOR_23022003THW_HPP