Bitcoin Core 22.99.0
P2P Digital Currency
reverse_iterator.h
Go to the documentation of this file.
1// Taken from https://gist.github.com/arvidsson/7231973
2
3#ifndef BITCOIN_REVERSE_ITERATOR_H
4#define BITCOIN_REVERSE_ITERATOR_H
5
14template <typename T>
16{
18
19public:
20 explicit reverse_range(T &x) : m_x(x) {}
21
22 auto begin() const -> decltype(this->m_x.rbegin())
23 {
24 return m_x.rbegin();
25 }
26
27 auto end() const -> decltype(this->m_x.rend())
28 {
29 return m_x.rend();
30 }
31};
32
33template <typename T>
35{
36 return reverse_range<T>(x);
37}
38
39#endif // BITCOIN_REVERSE_ITERATOR_H
Template used for reverse iteration in C++11 range-based for loops.
auto end() const -> decltype(this->m_x.rend())
auto begin() const -> decltype(this->m_x.rbegin())
#define T(expected, seed, data)
reverse_range< T > reverse_iterate(T &x)