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
template<typename Value>
class size_entry : public hpx::util::cache::entries::entry<Value>#
#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.

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 base_type = entry<Value>#

Private Members

std::size_t size_ = 0#

Friends

inline friend auto 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.

inline friend auto operator>(size_entry const &lhs, size_entry const &rhs) noexcept#
inline friend auto operator<=(size_entry const &lhs, size_entry const &rhs) noexcept#
inline friend auto operator>=(size_entry const &lhs, size_entry const &rhs) noexcept#
inline friend auto operator==(size_entry const &lhs, size_entry const &rhs) noexcept#
inline friend auto operator!=(size_entry const &lhs, size_entry const &rhs) noexcept#