[#BloombergLP-bslstl-BadWeakPtr] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::BadWeakPtr :relfileprefix: ../../ :mrdocs: This `class` provides an exception type thrown when a `weak_ptr` object is locked after the managed object has been destroyed. This class conforms to the C++11 standard specification of `std::bad_weak_ptr`. == Synopsis Declared in `<bslstl_badweakptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class BadWeakPtr : public std::exception ---- == Base Classes [cols="1,4"] |=== | Name| Description | `std::exception` | Base class for all library exceptions. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/BadWeakPtr/2constructor.adoc[`BadWeakPtr`] [.small]#[constructor]# | Create a `BadWeakPtr` object. Note that this function is explicitly user‐declared, to make it simple to declare `const` objects of this type. | xref:BloombergLP/bslstl/BadWeakPtr/2destructor.adoc[`~BadWeakPtr`] [.small]#[destructor]# [.small]#[virtual]# | Destroy this object. | xref:BloombergLP/bslstl/BadWeakPtr/operator_assign-00.adoc[`operator=`] | | xref:BloombergLP/bslstl/BadWeakPtr/what.adoc[`what`] [.small]#[virtual]# | Return a pointer to the string literal "bad_weak_ptr", with a storage duration of the lifetime of the program. Note that the caller should _not_ attempt to free this memory. Note that the `bsls_exceptionutil` macro `BSLS_NOTHROW_SPEC` is deliberately not used here, as a number of standard libraries declare `what` in the base `exception` class explicitly with the no‐throw specification, even in a build that may not recognize exceptions. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#