mardi 4 août 2015

vector and deque are staying empty

I'm quite new to C++ and debugging so I've tried everything I could think of and search on internet but I found nothing to solve my issue. I am using g++ with C++11 on Xubuntu 14.04 alternatively with make or with codeblocks.

In a function GenerateMap() I am trying to use a StructMap std::deque<std::deque<MyStruct>> that belongs to the same class as StructMap but for some reason StructMap[x] is always an empty std::deque<MyStruct>. I tried assigning with the constructor or with assign and push_back and nothing worked. So I have tried with vector and I encountered the same issue.

Then I tested all the syntax I could think of : declaring StructMap inside the function, using resize, using int instead of MyStruct, doing all of this in another class...

But now I only have an empty vector/deque of empty vector/deque. I was using vector and deque before in this project and everything worked fine so it seems that the issue is not directly with my code (it compiles as usual, it's just that trying to get data from the vector gives a seg fault)

Do you have an idea about what is happening ?

Aucun commentaire:

Enregistrer un commentaire