LCOV - code coverage report
Current view: top level - usr/include/boost/iterator - reverse_iterator.hpp (source / functions) Hit Total Coverage
Test: ROSE Lines: 0 7 0.0 %
Date: 2022-12-08 13:48:47 Functions: 0 0 -
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14