Hi Thiago, On 04.11.22 16:49, Thiago Macieira wrote: > I've just hit this: should we make some of our very simple types even simpler > so they're structural types[1] and thus can be passed as template parameters? > > For example, QFlags. I've just tried it and I get: > > error: ‘QFlags<Qt::AlignmentFlag>’ is not a valid type for a template non-type > parameter because it is not structural > note: ‘QFlags<Qt::AlignmentFlag>::i’ is not public > > [1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0732r2.pdf
I wrote about this in the comparison sub-thread: On 03.11.22 10:40, Marc Mutz via Development wrote: > One can even now = default the equality operator. Then the compiler > creates one based on for member-wise equality. If all such members have > an = default'ed equality operator, and with a few other other > requirements, the type in question has Strong Structural Equality, and > thus can be used as arguments to non-type template parameters (NTTP). > QFlags and QFixed are examples where this might come in handy. There are > probably others, too. There's also https://bugreports.qt.io/browse/QTBUG-94266 I'll clone that for QFixed. Thanks, Marc _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development