rippled
Loading...
Searching...
No Matches
include
xrpl
beast
container
aged_container_utility.h
1
#ifndef BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
2
#define BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
3
4
#include <xrpl/beast/container/aged_container.h>
5
6
#include <
chrono
>
7
#include <
type_traits
>
8
9
namespace
beast
{
10
12
template
<
class
AgedContainer,
class
Rep,
class
Period>
13
typename
std::enable_if<is_aged_container<AgedContainer>::value
,
std::size_t
>::
14
type
15
expire
(AgedContainer& c,
std::chrono::duration<Rep, Period>
const
& age)
16
{
17
std::size_t
n(0);
18
auto
const
expired(c.clock().now() - age);
19
for
(
auto
iter(c.chronological.cbegin());
20
iter != c.chronological.cend() && iter.when() <= expired;)
21
{
22
iter = c.erase(iter);
23
++n;
24
}
25
return
n;
26
}
27
28
}
// namespace beast
29
30
#endif
chrono
std::chrono::duration
std::enable_if
beast
Definition
base_uint.h:653
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:15
std::size_t
type_traits
Generated by
1.9.8