Re: [Development] Use QMetaEnum::keyCount() to initialise array

2019-01-07 Thread Olivier Goffart
-- Olivier Woboq - Qt services and support - https://woboq.com - https://code.woboq.org > -Original Message- > From: Development On Behalf Of Thiago Macieira > Sent: Thursday, January 3, 2019 1:43 AM > To: development@qt-project.org > Subject: Re: [Development] Use QMetaEnum

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2019-01-07 Thread Thiago Macieira
On Monday, 7 January 2019 10:50:43 PST Tom Isaacson wrote: > I wonder if moc-ng could handle this? > https://woboq.com/blog/moc-with-clang.html As a plugin to Clang, it can do anything. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2019-01-07 Thread Tom Isaacson
I wonder if moc-ng could handle this? https://woboq.com/blog/moc-with-clang.html Tom Isaacson -Original Message- From: Development On Behalf Of Thiago Macieira Sent: Thursday, January 3, 2019 1:43 AM To: development@qt-project.org Subject: Re: [Development] Use QMetaEnum::keyCount

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2019-01-02 Thread Thiago Macieira
On Wednesday, 2 January 2019 09:45:29 -02 Thiago Macieira wrote: > Because the information is not known to the compiler at compile time. To be stricter: it *is* know to the compiler, but without a constexpr reflection API, we can't get the information out of the compiler and into code. -- Thia

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2019-01-02 Thread Jedrzej Nowacki
On Monday, December 31, 2018 2:56:29 PM CET Marco Bubke wrote: > Is it because the meta type information could be created later? What about adding > a constexpr version like: QMetaEnum::compileTimeFromType? Or do we wait for > static reflections? Yes, sometimes, but the fact that the output chang

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2019-01-02 Thread Thiago Macieira
On Monday, 31 December 2018 11:56:29 -02 Marco Bubke wrote: > Is it not nice to share your knowledge why it is not possible? Is it > because the meta type information could be created later? What about adding > a constexpr version like: QMetaEnum::compileTimeFromType? Or do we wait for > static re

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2018-12-31 Thread Marco Bubke
on behalf of Thiago Macieira Sent: Monday, December 31, 2018 12:51:46 PM To: development@qt-project.org Subject: Re: [Development] Use QMetaEnum::keyCount() to initialise array On Sunday, 30 December 2018 17:43:21 -02 Tom Isaacson wrote: > Is it possible to use QMetaEnum::keyCount()

Re: [Development] Use QMetaEnum::keyCount() to initialise array

2018-12-31 Thread Thiago Macieira
On Sunday, 30 December 2018 17:43:21 -02 Tom Isaacson wrote: > Is it possible to use QMetaEnum::keyCount() to initialise an array? > Something like: > > const QMetaEnum metaEnum = QMetaEnum::fromType(); > int MyArray[metaEnum.keyCount()]; Yes. This should compile with GCC and Clang. It us

[Development] Use QMetaEnum::keyCount() to initialise array

2018-12-30 Thread Tom Isaacson
Is it possible to use QMetaEnum::keyCount() to initialise an array? Something like: const QMetaEnum metaEnum = QMetaEnum::fromType(); int MyArray[metaEnum.keyCount()]; After asking this on the Qt-Interest forum I spent a bit of time investigating. Q_ENUM declares functions with Q_DECL_C