Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Qt have its own boost::optional alternative?

Tags:

c++

boost

qt

Does Qt have its own boost::optional alternative, or should I just use boost::optional?

like image 845
Šimon Tóth Avatar asked Nov 16 '15 13:11

Šimon Tóth


2 Answers

In C++17 there was introduced std::optional: https://en.cppreference.com/w/cpp/utility/optional

I think it's more usefull in Qt project, than boost one. There is still no any QOptional class in Qt.

like image 69
Nikxp Avatar answered Oct 11 '22 01:10

Nikxp


Qt has a 'variant' type, but not an 'optional' type. I think that boost::optional (or, in newer C++ versions, std::optional) is a reasonable choice.

like image 22
Toby Speight Avatar answered Oct 10 '22 23:10

Toby Speight