[Development] QOptional

Olivier Goffart olivier at woboq.com
Wed Aug 20 23:17:32 CEST 2014


On Wednesday 20 August 2014 22:04:24 Иван Комиссаров wrote:
> More, this implementation has a problem - QOptional(T) constructor can't be
> marked constexpr (as it uses placement new), which makes class useless for
> constant expressions at all.

It's valid in C++14
We need a new macro that only expends to constexpr with C++14.
Q_DECL_RELAXED_CONSTEXPR?
Q_DECL_CONSTEXPR_X?
Q_DECL_CONSTEXPR_14?

> Should i add also c++11 implementation based on
> unions? (what would happen if we use c++98 compiled Qt with c++11 compiled
> app?)

Good idea.  
Just Make sure it is binary compatible :-)


-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org






More information about the Development mailing list