samedi 25 novembre 2017

c++ error: new initializer expression list treated as compound expression

I am new to C++ and I am getting the error for initializing array member in a struct. Please help.

     // DummyInfo creates a dummy info object
    NBDLL::Info* NBDLL::dummyInfo() {
        //NBDLL::Info* info = new Info();
//error in the below line
        NBDLL::Info* info = new NBDLL::Info({nullptr,nullptr,nullptr},{nullptr,nullptr,nullptr},nullptr,nullptr,false,DUMMY); 
            /*info->nodes = {NULL,NULL,NULL};
            info->oldInfo = {nullptr,nullptr,nullptr};
            info->newNext = nullptr;
            info->newPrev = nullptr;
            info->remove = false;
            info->status = DUMMY;*/
            return info;
    }

    //Info instance
    typedef struct Info{
        Node* nodes[3];
        Info* oldInfo[3];
        Node* newNext;
        Node* newPrev;
        bool remove;
        State status;
    };

Aucun commentaire:

Enregistrer un commentaire