]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/iterator/reverse_iterator.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
59bbbc06debf0514d6d5ea1f489600d11e858b1d
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / iterator / reverse_iterator.hpp
1 // (C) Copyright David Abrahams 2002.\r
2 // (C) Copyright Jeremy Siek    2002.\r
3 // (C) Copyright Thomas Witt    2002.\r
4 // Distributed under the Boost Software License, Version 1.0. (See\r
5 // accompanying file LICENSE_1_0.txt or copy at\r
6 // http://www.boost.org/LICENSE_1_0.txt)\r
7 #ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP\r
8 #define BOOST_REVERSE_ITERATOR_23022003THW_HPP\r
9 \r
10 #include <boost/iterator.hpp>\r
11 #include <boost/utility.hpp>\r
12 #include <boost/iterator/iterator_adaptor.hpp>\r
13 \r
14 namespace boost\r
15 {\r
16 \r
17   //\r
18   //\r
19   //\r
20   template <class Iterator>\r
21   class reverse_iterator\r
22       : public iterator_adaptor< reverse_iterator<Iterator>, Iterator >\r
23   {\r
24       typedef iterator_adaptor< reverse_iterator<Iterator>, Iterator > super_t;\r
25 \r
26       friend class iterator_core_access;\r
27 \r
28    public:\r
29       reverse_iterator() {}\r
30 \r
31       explicit reverse_iterator(Iterator x) \r
32           : super_t(x) {}\r
33 \r
34       template<class OtherIterator>\r
35       reverse_iterator(\r
36           reverse_iterator<OtherIterator> const& r\r
37           , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0\r
38           )\r
39           : super_t(r.base())\r
40       {}\r
41 \r
42    private:\r
43       typename super_t::reference dereference() const { return *boost::prior(this->base()); }\r
44     \r
45       void increment() { --this->base_reference(); }\r
46       void decrement() { ++this->base_reference(); }\r
47 \r
48       void advance(typename super_t::difference_type n)\r
49       {\r
50           this->base_reference() += -n;\r
51       }\r
52 \r
53       template <class OtherIterator>\r
54       typename super_t::difference_type\r
55       distance_to(reverse_iterator<OtherIterator> const& y) const\r
56       {\r
57           return this->base_reference() - y.base();\r
58       }\r
59   };\r
60 \r
61   template <class BidirectionalIterator>\r
62   reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)\r
63   {\r
64       return reverse_iterator<BidirectionalIterator>(x);\r
65   }\r
66 \r
67 } // namespace boost\r
68 \r
69 #endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP\r