Setting bool data member inside struct

21 views
Skip to first unread message

Kumar

unread,
Feb 7, 2018, 12:38:10 AM2/7/18
to ngrest
Hi,

Is it possible to set bool data member inside struct

I want to set bool member as false as default. is it possible? I tried but giving following error.
struct item
{
    bool flag = false;
};
W/07-02-2018 10:50:30.046 CppParser.cpp:574 parseDataType: Can't find type declaration: bool flag =
E/07-02-2018 10:50:30.060 main.cpp:329 main: Exception:
Serialization of type is not supported: bool flag =: unknown

Thanks,
Santhosh

Dmitry Utkin

unread,
Feb 8, 2018, 3:10:39 AM2/8/18
to ngrest
The codegen isn't quite C++11.

You have to initialize it in constructor.

struct item
{
    bool flag;

    item(): flag(false) {}
};

среда, 7 февраля 2018 г., 8:38:10 UTC+3 пользователь Kumar написал:
Reply all
Reply to author
Forward
0 new messages