mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 08:29:44 -04:00
util: add compile-time validation tests for intrusive red black trees
This commit is contained in:
parent
57b6c71c1c
commit
ed80d6ec8c
4 changed files with 288 additions and 56 deletions
|
@ -550,7 +550,7 @@ namespace ams::util {
|
|||
constexpr ALWAYS_INLINE const Derived *GetNext() const { return static_cast<const Derived *>(impl::IntrusiveRedBlackTreeImpl::GetNext(this)); }
|
||||
};
|
||||
|
||||
template<class Derived>
|
||||
template<class Derived> requires std::derived_from<Derived, IntrusiveRedBlackTreeNode>
|
||||
class IntrusiveRedBlackTreeBaseTraits {
|
||||
public:
|
||||
template<class Comparator>
|
||||
|
|
|
@ -30,10 +30,10 @@ namespace ams::util {
|
|||
bool active;
|
||||
public:
|
||||
constexpr ALWAYS_INLINE ScopeGuard(F f) : f(std::move(f)), active(true) { }
|
||||
ALWAYS_INLINE ~ScopeGuard() { if (active) { f(); } }
|
||||
ALWAYS_INLINE void Cancel() { active = false; }
|
||||
constexpr ALWAYS_INLINE ~ScopeGuard() { if (active) { f(); } }
|
||||
constexpr ALWAYS_INLINE void Cancel() { active = false; }
|
||||
|
||||
ALWAYS_INLINE ScopeGuard(ScopeGuard&& rhs) : f(std::move(rhs.f)), active(rhs.active) {
|
||||
constexpr ALWAYS_INLINE ScopeGuard(ScopeGuard&& rhs) : f(std::move(rhs.f)), active(rhs.active) {
|
||||
rhs.Cancel();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue