[Development] QOptional

Ziller Eike Eike.Ziller at digia.com
Thu Aug 21 17:54:49 CEST 2014


On Aug 21, 2014, at 5:16 PM, Marc Mutz <marc.mutz at kdab.com> wrote:

> On Thursday 21 August 2014 16:52:05 Thiago Macieira wrote:
>> But I'd like QOptional<QString> o = QString() result in a null
>> (disengaged)  QOptional too.

Why would that be?
The optional got a QString value assigned. It shouldn’t care about more.

> Too clever for a general optional class, IMO:
> 
>  QOptional<QString> qs = QString();
>  QOptional<std::string> ss = std::string();
> 
> qs will be disengaged and ss will be engaged. Hard to explain in the docs. 
> Impossible to anticipate for new users of the class. Death row for template 
> code.

I agree.

-- 
Eike Ziller, Senior Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 144331 B 




More information about the Development mailing list