32 template <
typename T,
unsigned size = 1>
38 std::array<std::size_t, size>
priv;
39 std::array<std::size_t, size>
post;
57 void clear(
const T& val = T()) {
64 void access(
const T& val) {
66 for (std::size_t
i = 0;
i <
size;
i++) {
118 template <
typename Op>
129 template <
typename Op>
130 bool any(
const Op& op)
const {
135 template <
typename T,
unsigned size>
136 std::ostream&
operator<<(std::ostream& out,
const LRUCache<T, size>& cache) {
138 cache.forEachInOrder([&](
const T& val) {
150 template <
typename T>
151 class LRUCache<T, 1> {
160 LRUCache(
const T& val) : entry(val) {}
168 void access(
const T& val) {
175 template <
typename Op>
181 template <
typename Op>
182 bool any(
const Op& op)
const {
189 return out << cache.entry;
194 template <
typename T>
213 template <
typename Op>
219 template <
typename Op>
220 bool any(
const Op& op)
const {
227 return out <<
"-empty-";
238 #ifdef _SOUFFLE_STATS
243 std::atomic<std::size_t> hits;
244 std::atomic<std::size_t> misses;
250 hits.fetch_add(1, std::memory_order_relaxed);
253 misses.fetch_add(1, std::memory_order_relaxed);