Fabcoin Core  0.16.2
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 FABCOIN_REVERSE_ITERATOR_H
4 #define FABCOIN_REVERSE_ITERATOR_H
5 
14 template <typename T>
16 {
17  T &m_x;
18 
19 public:
20  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 
33 template <typename T>
35 {
36  return reverse_range<T>(x);
37 }
38 
39 #endif // FABCOIN_REVERSE_ITERATOR_H
Template used for reverse iteration in C++11 range-based for loops.
#define T(i, x)
reverse_range< T > reverse_iterate(T &x)
#define x(i)
auto end() const -> decltype(this->m_x.rend())
auto begin() const -> decltype(this->m_x.rbegin())