xo-umbrella2/xo-gc/include/xo/gc/object_age.hpp
Roland Conybeare f229baa2e1 git subrepo clone git@github.com:Rconybea/xo-gc.git xo-gc
subrepo:
  subdir:   "xo-gc"
  merged:   "b1898230"
upstream:
  origin:   "git@github.com:Rconybea/xo-gc.git"
  branch:   "main"
  commit:   "b1898230"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:10:28 -04:00

44 lines
1 KiB
C++

/** @file object_age.hpp
*
* @author Roland Conybeare, Dec 2025
**/
#pragma once
#include <cstdint>
namespace xo {
namespace mm {
/** hard maximum remembered object age **/
static constexpr uint32_t c_max_object_age = 127;
/** @class object_age
* @brief type-safe object age
*
* Object age measured in number of garbage collections survived.
**/
struct object_age {
using value_type = std::uint32_t;
explicit object_age(value_type x) : value_{x} {}
operator value_type() const { return value_; }
std::uint32_t value_;
};
inline bool operator==(object_age lhs, object_age rhs) {
return lhs.value_ == rhs.value_;
}
inline bool operator<(object_age lhs, object_age rhs) {
return lhs.value_ < rhs.value_;
}
inline bool operator>(object_age lhs, object_age rhs) {
return lhs.value_ > rhs.value_;
}
}
}
/* end object_age.hpp */