xrpld
Loading...
Searching...
No Matches
include
xrpl
beast
container
aged_container_utility.h
1
#pragma once
2
3
#include <xrpl/beast/container/aged_container.h>
4
5
#include <
chrono
>
6
#include <
cstddef
>
7
8
namespace
beast
{
9
13
template
<
class
AgedContainer,
class
Rep,
class
Period>
14
std::size_t
15
expire
(AgedContainer& c,
std::chrono::duration<Rep, Period>
const
& age)
16
requires
(
IsAgedContainer<AgedContainer>::value
)
17
{
18
std::size_t
n(0);
19
auto
const
expired(c.clock().now() - age);
20
for
(
auto
iter(c.chronological.cbegin());
21
iter != c.chronological.cend() && iter.when() <= expired;)
22
{
23
iter = c.erase(iter);
24
++n;
25
}
26
return
n;
27
}
28
29
}
// namespace beast
chrono
cstddef
std::chrono::duration
beast
Definition
base_uint.h:691
beast::expire
std::size_t expire(AgedContainer &c, std::chrono::duration< Rep, Period > const &age)
Expire aged container items past the specified age.
Definition
aged_container_utility.h:15
std::size_t
beast::IsAgedContainer
Definition
aged_container.h:9
Generated by
1.16.1