LCOV - code coverage report
Current view: top level - src - reverse_iterator.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 10 10 100.0 %
Date: 2021-06-29 14:35:33 Functions: 28 28 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 0 0 -

           Branch data     Line data    Source code
#       1                 :            : // Taken from https://gist.github.com/arvidsson/7231973
#       2                 :            : 
#       3                 :            : #ifndef BITCOIN_REVERSE_ITERATOR_H
#       4                 :            : #define BITCOIN_REVERSE_ITERATOR_H
#       5                 :            : 
#       6                 :            : /**
#       7                 :            :  * Template used for reverse iteration in C++11 range-based for loops.
#       8                 :            :  *
#       9                 :            :  *   std::vector<int> v = {1, 2, 3, 4, 5};
#      10                 :            :  *   for (auto x : reverse_iterate(v))
#      11                 :            :  *       std::cout << x << " ";
#      12                 :            :  */
#      13                 :            : 
#      14                 :            : template <typename T>
#      15                 :            : class reverse_range
#      16                 :            : {
#      17                 :            :     T &m_x;
#      18                 :            : 
#      19                 :            : public:
#      20                 :    1312128 :     explicit reverse_range(T &x) : m_x(x) {}
#      21                 :            : 
#      22                 :            :     auto begin() const -> decltype(this->m_x.rbegin())
#      23                 :    1312128 :     {
#      24                 :    1312128 :         return m_x.rbegin();
#      25                 :    1312128 :     }
#      26                 :            : 
#      27                 :            :     auto end() const -> decltype(this->m_x.rend())
#      28                 :    1312128 :     {
#      29                 :    1312128 :         return m_x.rend();
#      30                 :    1312128 :     }
#      31                 :            : };
#      32                 :            : 
#      33                 :            : template <typename T>
#      34                 :            : reverse_range<T> reverse_iterate(T &x)
#      35                 :    1312128 : {
#      36                 :    1312128 :     return reverse_range<T>(x);
#      37                 :    1312128 : }
#      38                 :            : 
#      39                 :            : #endif // BITCOIN_REVERSE_ITERATOR_H

Generated by: LCOV version 1.14