deduction guides for std::optional

From cppreference.com
< cpp‎ | utility‎ | optional
Utilities library
Defined in header <optional>
template < class T >
optional(T) - > optional<T> ;
(since C++17)

One deduction guide is provided for std::optional

Example

#include <optional>
#include <type_traits>
 
int main()
{
    int a[2];
    std::optional oa{a}; // uses explicit deduction guide
    static_assert(std::is_same_v<decltype(oa), std::optional<int*>> == true);
}