[#absl-optional_ref-0c-2constructor-093] = xref:absl.adoc[absl]::xref:absl/optional_ref-0c.adoc[optional_ref]::optional_ref :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<absl/types/optional_ref.h>` Constructs an empty `optional_ref`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:absl/optional_ref-0c/2constructor-0e1.adoc[optional_ref](); ---- [.small]#xref:absl/optional_ref-0c/2constructor-0e1.adoc[_» more..._]# Copies an `optional_ref`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:absl/optional_ref-0c/2constructor-0d.adoc[optional_ref](xref:absl/optional_ref-0c.adoc[optional_ref<T>] const& other) = default; ---- [.small]#xref:absl/optional_ref-0c/2constructor-0d.adoc[_» more..._]# Constructs an empty `optional_ref` from `std::nullopt`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:absl/optional_ref-0c/2constructor-0c.adoc[optional_ref](std::nullopt_t input); ---- [.small]#xref:absl/optional_ref-0c/2constructor-0c.adoc[_» more..._]# Deleted to forbid a naked `nullptr`; use `std::nullopt` instead. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:absl/optional_ref-0c/2constructor-0b.adoc[optional_ref](std::nullptr_t input) = delete; ---- [.small]#xref:absl/optional_ref-0c/2constructor-0b.adoc[_» more..._]# Constructs an `optional_ref` referring to a concrete value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:absl/optional_ref-0c/2constructor-0f.adoc[optional_ref](T& input); ---- [.small]#xref:absl/optional_ref-0c/2constructor-0f.adoc[_» more..._]# Constructs an `optional_ref` from a pointer, where null means absent. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:absl/optional_ref-0c/2constructor-04.adoc[optional_ref](T* input); ---- [.small]#xref:absl/optional_ref-0c/2constructor-04.adoc[_» more..._]# Converts from an `optional_ref<U>` when `U*` converts to `T*`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename U, typename = xref:absl/optional_ref-0c.adoc[EnableIfConvertibleFrom<U>]> constexpr xref:absl/optional_ref-0c/2constructor-0e0.adoc[optional_ref](xref:absl/optional_ref-0c.adoc[optional_ref<U>] input); ---- [.small]#xref:absl/optional_ref-0c/2constructor-0e0.adoc[_» more..._]# Constructs an `optional_ref` from a mutable `std::optional`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename U, typename = xref:absl/optional_ref-0c.adoc[EnableIfConvertibleFrom<U>]> constexpr xref:absl/optional_ref-0c/2constructor-099.adoc[optional_ref](std::optional<U>& input); ---- [.small]#xref:absl/optional_ref-0c/2constructor-099.adoc[_» more..._]# Constructs an `optional_ref` from a const `std::optional`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename U, typename = xref:absl/optional_ref-0c.adoc[EnableIfConvertibleFrom<U const>]> constexpr xref:absl/optional_ref-0c/2constructor-06.adoc[optional_ref](std::optional<U> const& input); ---- [.small]#xref:absl/optional_ref-0c/2constructor-06.adoc[_» more..._]# == Parameters [cols="1,4"] |=== | Name| Description | *other* | The reference to copy. | *input* | The `std::nullopt` tag. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#