veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
reversed_range.hpp
1
// Copyright (c) 2019-2022 Xenios SEZC
2
// https://www.veriblock.org
3
// Distributed under the MIT software license, see the accompanying
4
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5
6
#ifndef VERIBLOCK_POP_CPP_REVERSE_SUBRANGE_HPP
7
#define VERIBLOCK_POP_CPP_REVERSE_SUBRANGE_HPP
8
9
#include <vector>
10
11
namespace
altintegration
{
12
15
template
<
typename
T>
16
class
reverse_range
{
17
T &m_x;
18
19
public
:
20
explicit
reverse_range
(T &x) : m_x(x) {}
21
22
auto
begin()
const
->
decltype
(this->m_x.rbegin()) {
return
m_x.rbegin(); }
23
24
auto
end()
const
->
decltype
(this->m_x.rend()) {
return
m_x.rend(); }
25
};
26
28
template
<
typename
T>
29
reverse_range<T>
reverse_iterate
(T &x) {
30
return
reverse_range<T>
(x);
31
}
32
33
}
// namespace altintegration
34
35
#endif
// VERIBLOCK_POP_CPP_REVERSE_SUBRANGE_HPP
altintegration::reverse_range
translates a pair of forward iterators to a range whose regular iteration order is "backward"
Definition:
reversed_range.hpp:16
altintegration
Defines logging helpers.
Definition:
block.hpp:14
altintegration::reverse_iterate
reverse_range< T > reverse_iterate(T &x)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition:
reversed_range.hpp:29