On Thursday 21 August 2014 11:34:17 Иван Комиссаров wrote:
> Иван Комиссаров
>
> 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!
Sorry, then:
if (opt1 == false)
// ?
if (opt2 == false)
// ?
Does it have operator==(T)? Does it have operator RestrictedBool() / explicit
operator bool()?
Then there is a problem.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development