1

I am reading std::optional in the page 539 of the draft n4791.

I notice that there is a

template<class T>
optional(T) -> optional<T>;

What is the meaning of this statement?

How does it affect std::optional?

Thanks.

Caesar
  • 971
  • 6
  • 13

1 Answers1

1

That's a deduction guide. It allows statements like this:

std::optional o(42);  // o has type std::optional<int>
Brian Bi
  • 111,498
  • 10
  • 176
  • 312