Bitcoin ABC
0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
src
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_HPP
4
#define BITCOIN_REVERSE_ITERATOR_HPP
5
14
template
<
typename
T>
class
reverse_range
{
15
T &
x
;
16
17
public
:
18
explicit
reverse_range
(T &
xin
) :
x
(
xin
) {}
19
20
auto
begin
() const ->
decltype
(
this
->
x
.rbegin()) {
return
x
.rbegin(); }
21
22
auto
end
() const ->
decltype
(
this
->
x
.rend()) {
return
x
.rend(); }
23
};
24
25
template
<
typename
T>
reverse_range<T>
reverse_iterate
(T &x) {
26
return
reverse_range<T>
(x);
27
}
28
29
#endif
// BITCOIN_REVERSE_ITERATOR_HPP
reverse_range
Template used for reverse iteration in C++11 range-based for loops.
Definition
reverse_iterator.h:14
reverse_range::reverse_range
reverse_range(T &xin)
Definition
reverse_iterator.h:18
reverse_range::x
T & x
Definition
reverse_iterator.h:15
reverse_range::begin
auto begin() const -> decltype(this->x.rbegin())
Definition
reverse_iterator.h:20
reverse_range::end
auto end() const -> decltype(this->x.rend())
Definition
reverse_iterator.h:22
GetRand
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition
random.h:85
reverse_iterate
reverse_range< T > reverse_iterate(T &x)
Definition
reverse_iterator.h:25
Generated on Fri Nov 22 2024 02:38:23 for Bitcoin ABC by
1.9.8