#pragma once #include #include #include namespace beast { /** Expire aged container items past the specified age. */ template std::enable_if_t::value, std::size_t> expire(AgedContainer& c, std::chrono::duration const& age) { std::size_t n(0); auto const expired(c.clock().now() - age); for (auto iter(c.chronological.cbegin()); iter != c.chronological.cend() && iter.when() <= expired;) { iter = c.erase(iter); ++n; } return n; } } // namespace beast