Иван Комиссаров
21 авг. 2014 г., в 2:10, Thiago Macieira <[email protected]> написал(а):
> The optional-cast-to-boolean is a source of problems for the current
> std::optional. That hasn't been solved.
>
> QOptional<bool> opt1 = false;
> QOptional<int> opt2 = 0;
> if (opt1)
> // this is true!
> if (opt2)
> // this is false!
Hm, what? QOptional has no operator T and can't be converted to any value (bool
or not) directly.
QOptional<bool> opt1 = false;
QOptional<int> opt2 = 0;
if (opt1)
// this is true!
if (*opt1)
// this is false!
if (opt2)
// this is true!
if (*opt2)
// this is false!
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development