[#BloombergLP-bslstl-Optional_ConstructsFromType]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::Optional&lowbar;ConstructsFromType
:relfileprefix: ../../
:mrdocs:

Metafunction detecting constructibility from a non&hyphen;optional type&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;optional&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;TYPE,
    class t&lowbar;ANY&lowbar;TYPE&gt;
struct Optional&lowbar;ConstructsFromType
    : xref:bsl/integral_constant-02.adoc[bsl::integral&lowbar;constant&lt;bool, !bslmf&colon;&colon;IsAccessibleBaseOf&lt;bsl&colon;&colon;optional&lt;t&lowbar;TYPE&gt;, typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type&gt;&colon;&colon;value &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type, bsl&colon;&colon;nullopt&lowbar;t&gt;&colon;&colon;value &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type, bsl&colon;&colon;in&lowbar;place&lowbar;t&gt;&colon;&colon;value &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type, bsl&colon;&colon;allocator&lowbar;arg&lowbar;t&gt;&colon;&colon;value &amp;&amp; std&colon;&colon;is&lowbar;constructible&lt;t&lowbar;TYPE, t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;value&gt;]
----

== Description

This metafunction is derived from `bsl&colon;&colon;true&lowbar;type` if `t&lowbar;ANY&lowbar;TYPE` is not derived from `bsl&colon;&colon;optional&lt;t&lowbar;TYPE&gt;`, `t&lowbar;ANY&lowbar;TYPE` is not a tag type, and `t&lowbar;TYPE` is constructible from `t&lowbar;ANY&lowbar;TYPE`&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:bsl/integral_constant-02.adoc[bsl::integral&lowbar;constant&lt;bool, !bslmf&colon;&colon;IsAccessibleBaseOf&lt;bsl&colon;&colon;optional&lt;t&lowbar;TYPE&gt;, typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type&gt;&colon;&colon;value &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type, bsl&colon;&colon;nullopt&lowbar;t&gt;&colon;&colon;value &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type, bsl&colon;&colon;in&lowbar;place&lowbar;t&gt;&colon;&colon;value &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;typename bsl&colon;&colon;remove&lowbar;cvref&lt;t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;type, bsl&colon;&colon;allocator&lowbar;arg&lowbar;t&gt;&colon;&colon;value &amp;&amp; std&colon;&colon;is&lowbar;constructible&lt;t&lowbar;TYPE, t&lowbar;ANY&lowbar;TYPE&gt;&colon;&colon;value&gt;]`
| Metafunction representing a compile&hyphen;time constant of the specified (template parameter) `t&lowbar;TYPE` with the specified (template parameter) `t&lowbar;VALUE`&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/integral_constant-02/type.adoc[`type`] 
| Alias for this `integral&lowbar;constant` specialization&period;
| xref:bsl/integral_constant-02/value_type.adoc[`value&lowbar;type`] 
| Alias for the (template parameter) `t&lowbar;TYPE`&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/integral_constant-02/operator_call.adoc[`operator()`] 
| Return a copy of the template argument `t&lowbar;VALUE`&period;
| xref:bsl/integral_constant-02/2conversion.adoc[`operator t&lowbar;TYPE`] 
| Return a copy of the template argument `t&lowbar;VALUE`&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:bsl/integral_constant-02/value.adoc[`value`] 
| The compile&hyphen;time constant value of this metafunction&period;
|===



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