[Development] QOptional

Marc Mutz marc.mutz at kdab.com
Wed Aug 20 21:27:44 CEST 2014


On Wednesday 20 August 2014 21:03:21 Иван Комиссаров wrote:
> I'm not sure QOptional should mimick T*, not QVariant, but ok.

 QOptional<T> opt;
 T *pt;
 QVariant v;

 if (opt) ...
 if (tp) ...
 if (v) ... // ERROR                             
 if (!opt) // operator! missing, btw
 if (!tp)
 if (!v)    // ERROR

 T t = *opt;
 T t = *tp;
 T t = *v;  // ERROR

Seems pretty clear to me it already models T*, not QVariant... :)

-- 
Qt Developer Days 2014 - October 6 - 8 at BCC, Berlin

Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions



More information about the Development mailing list