From a43b9f3faa5a06a4ac91570b7efbf95893cc0ec0 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sun, 5 Jan 2014 22:57:41 +0900 Subject: [PATCH] support const_iterator_cast: reverse_iterator --- sprout/iterator/reverse_iterator.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sprout/iterator/reverse_iterator.hpp b/sprout/iterator/reverse_iterator.hpp index 25444737..938f37c7 100644 --- a/sprout/iterator/reverse_iterator.hpp +++ b/sprout/iterator/reverse_iterator.hpp @@ -14,7 +14,9 @@ #include #include #include +#include #include +#include namespace sprout { // @@ -200,6 +202,26 @@ namespace sprout { iterator_prev(sprout::reverse_iterator const& it) { return it.prev(); } + + // + // is_const_iterator_cast_convertible + // + template + struct is_const_iterator_cast_convertible, sprout::reverse_iterator > + : public sprout::is_const_iterator_cast_convertible + {}; + // + // const_iterator_conversion + // + template< + typename T, + typename Iterator, + typename sprout::enabler_if, T>::value>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR T + const_iterator_conversion(sprout::reverse_iterator const& it) { + return T(sprout::const_iterator_cast(it.base())); + } } // namespace sprout #endif // #ifndef SPROUT_ITERATOR_REVERSE_ITERATOR_HPP