[#BloombergLP-ball-BroadcastObserver-findObserver-0a]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/BroadcastObserver.adoc[BroadcastObserver]::findObserver
:relfileprefix: ../../../
:mrdocs:

Load a typed shared pointer to the named observer into `result`&period;

== Synopsis

Declared in `&lt;ball&lowbar;broadcastobserver&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;OBSERVER&gt;
int
findObserver(
    xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;t&lowbar;OBSERVER const&gt;]* result,
    std::string&lowbar;view const& observerName) const
requires bsl&colon;&colon;is&lowbar;convertible&lt;const t&lowbar;OBSERVER &ast;,
                                             const ball&colon;&colon;Observer &ast;&gt;&colon;&colon;value;
----

== Description

Load into the specified `result` a shared pointer to the observer of (template parameter) `t&lowbar;OBSERVER` type having the specified `observerName` in the registry of this broadcast observer, and an empty shared pointer if there is no such observer otherwise&period; Return 0 if a non&hyphen;empty shared pointer was loaded, and a non&hyphen;zero value otherwise&period; Note that an empty shared pointer will be loaded if either no observer having `observerName` is in the registry or the observer registered with that name is not of `t&lowbar;OBSERVER` type&period;

The implementation is placed here in the class definition to work around a Microsoft C&plus;&plus; compiler (version 16) bug where the definition cannot be matched to the declaration when an `enable&lowbar;if` is used&period;

== Return Value

0 if a non&hyphen;empty shared pointer was loaded, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| destination for the typed shared pointer to the observer
| *observerName*
| name of the observer to find
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
