hpx/cache/entries/size_entry.hpp#

Defined in header hpx/cache/entries/size_entry.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace util
namespace cache
namespace entries
class size_entry#
#include <hpx/cache/entries/size_entry.hpp>

The size_entry type can be used to store values in a cache which have a size associated (such as files, etc.). Using this type as the cache’s entry type makes sure that the entries with the biggest size are discarded from the cache first.

Note

The size_entry conforms to the CacheEntry concept.

Note

This type can be used to model a ‘discard smallest first’ cache policy if it is used with a std::greater as the caches’ UpdatePolicy (instead of the default std::less).

Template Parameters
  • Value – The data type to be stored in a cache. It has to be default constructible, copy constructible and less_than_comparable.

  • Derived – The (optional) type for which this type is used as a base class.

Public Functions

size_entry() = default#

Any cache entry has to be default constructible.

inline explicit size_entry(Value const &val, std::size_t size = 0) noexcept(std::is_nothrow_constructible_v<base_type, Value const&>)#

Construct a new instance of a cache entry holding the given value.

inline explicit size_entry(Value &&val, std::size_t size = 0) noexcept#

Construct a new instance of a cache entry holding the given value.

inline constexpr std::size_t get_size() const noexcept#

Return the ‘size’ of this entry.

Private Types

using derived_type = typename detail::size_derived<Value, Derived>::type#
using base_type = entry<Value, derived_type>#

Private Members

std::size_t size_ = 0#

Friends

inline friend constexpr friend bool operator< (size_entry const &lhs, size_entry const &rhs) noexcept

Compare the ‘age’ of two entries. An entry is ‘older’ than another entry if it has a bigger size.