bsl::shared_ptr::operator BoolType

Return whether this shared_ptr refers to an object.

Synopsis

Declared in <bslstl_sharedptr.h>

operator BoolType() const noexcept;

Description

Return a value of an "unspecified bool" type that evaluates to false if this shared pointer does not refer to an object, and true otherwise. Note that this conversion operator allows a shared pointer to be used within a conditional context (e.g., within an if or while statement), but does not allow shared pointers to unrelated types to be compared (e.g., via < or >).

Return Value

unspecified bool that is true if this refers to an object