rippled
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 <
type_traits
>
7
8
namespace
beast
{
9
11
template
<
class
AgedContainer,
class
Rep,
class
Period>
12
typename
std::enable_if<is_aged_container<AgedContainer>::value
,
std::size_t
>::type
13
expire
(AgedContainer& c,
std::chrono::duration<Rep, Period>
const
& age)
14
{
15
std::size_t
n(0);
16
auto
const
expired(c.clock().now() - age);
17
for
(
auto
iter(c.chronological.cbegin()); iter != c.chronological.cend() && iter.when() <= expired;)
18
{
19
iter = c.erase(iter);
20
++n;
21
}
22
return
n;
23
}
24
25
}
// namespace beast
chrono
std::chrono::duration
std::enable_if
beast
Definition
base_uint.h:637
beast::expire
std::enable_if< is_aged_container< AgedContainer >::value, std::size_t >::type expire(AgedContainer &c, std::chrono::duration< Rep, Period > const &age)
Expire aged container items past the specified age.
Definition
aged_container_utility.h:13
std::size_t
type_traits
Generated by
1.9.8