Ticket #4189: transform_iterator.2.patch
File transform_iterator.2.patch, 1.5 KB (added by , 12 years ago) |
---|
-
boost/iterator/transform_iterator.hpp
14 14 #include <boost/iterator/iterator_categories.hpp> 15 15 #include <boost/mpl/not.hpp> 16 16 #include <boost/mpl/bool.hpp> 17 #include <boost/optional.hpp> 17 18 #include <boost/type_traits/function_traits.hpp> 19 #include <boost/type_traits/has_trivial_constructor.hpp> 18 20 #include <boost/type_traits/is_const.hpp> 19 21 #include <boost/type_traits/is_class.hpp> 20 22 #include <boost/type_traits/is_function.hpp> … … 130 132 {} 131 133 132 134 UnaryFunc functor() const 133 { return m_f; }135 { return unwrap_functor(m_f); } 134 136 135 137 private: 136 138 typename super_t::reference dereference() const 137 { return m_f(*this->base()); }139 { return unwrap_functor(m_f)(*this->base()); } 138 140 141 UnaryFunc const& unwrap_functor(UnaryFunc const& t) const 142 { return t; } 143 144 UnaryFunc const& unwrap_functor(optional<UnaryFunc> const& t) const 145 { return *t; } 146 147 typedef typename mpl::if_< 148 mpl::and_< 149 is_class<UnaryFunc> 150 , mpl::not_<has_trivial_constructor<UnaryFunc> > 151 > 152 , optional<UnaryFunc> 153 , UnaryFunc 154 >::type unary_functor_type; 155 139 156 // Probably should be the initial base class so it can be 140 157 // optimized away via EBO if it is an empty class. 141 UnaryFuncm_f;158 unary_functor_type m_f; 142 159 }; 143 160 144 161 template <class UnaryFunc, class Iterator>