Skip to content

Modern SharedPtr Expired

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Smart Pointers › SharedPtr and WeakPtr › Expired

Expired

Returns true once the object has been destroyed.

Syntax

Expired( ) as boolean

Examples

#import "std/memory"
using memory

type Node
    as int32 id
end type

dim w as WeakPtr( of Node )

scope
    dim p as SharedPtr( of Node ) = MakeShared( of Node )( )
    w = p
    print w.Expired( )       '' false -- a strong handle still holds it
end scope

print w.Expired( )           '' true -- the object is gone

'' Expired( ) is a question about the PAST instant it was asked. Lock( )
'' and then test the handle when the answer must still hold afterwards.

Library: SharedPtr and WeakPtr
Category: Smart Pointers
Documented under: Members

Clone this wiki locally