Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
deductiongu...td::optional(3) C++ Standard Libarydeductiongu...td::optional(3)

NAME
       deductionguidesforstd::optional - deductionguidesforstd::optional

Synopsis
	  Defined in header <optional>
	  template< class T >		(since C++17)
	  optional(T) -> optional<T>;

	  One deduction	guide is provided for std::optional to account for the
       edge cases
	  missed by the	implicit deduction guides, in particular, non-copyable
       arguments and
	  array	to pointer conversion.

Example
       // Run this code

	#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);
	}

http://cppreference.com		  2024.06.10	 deductiongu...td::optional(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=deductionguidesforstd::optional&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help