JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
jh::weak_ptr_eq< T > Struct Template Referencefinal

Equality functor for std::weak_ptr<T>. More...

#include <jh/concurrent/observe_pool.h>

Public Member Functions

bool operator() (const std::weak_ptr< T > &lhs, const std::weak_ptr< T > &rhs) const noexcept

Detailed Description

template<typename T>
requires requires(const T &lhs, const T &rhs){ { lhs == rhs } -> std::convertible_to<bool>; }
struct jh::weak_ptr_eq< T >

Equality functor for std::weak_ptr<T>.

Behavior:

  • If either pointer is expired, comparison yields false.
  • If both are valid, comparison is delegated to the underlying T::operator==().

Purpose:

Allows weak pointers to be compared by the logical content of their targets, ensuring that semantically identical live objects match in pooling structures. Expired entries are safely treated as distinct.

Template Parameters
TThe managed type, which must satisfy equality comparing.

The documentation for this struct was generated from the following file: