std::vector initialization problem

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
Orc Shaman
Posts: 777
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 23

std::vector initialization problem

Post by drwbns »

Hi guys, I'm trying to initialize a vector like this -

Code: Select all

std::vector<std::vector<hkReal>> *terrainVertices;
But I'm just getting a crash in the <vector> cpp file so I'm guessing there's something wrong here. Any thoughts on this one?

Posts: 6
Joined: Tue Jul 15, 2014 12:17 am
x 1

Re: std::vector initialization problem

Post by Alessan »


If you use a pointer, you must allocate memory for it.

std::vector<std::vector<hkReal>> *terrainVertices = new std::vector<std::vector<hkReal>>();

User avatar
OGRE Team Member
OGRE Team Member
Posts: 4369
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 887

Re: std::vector initialization problem

Post by dark_sylinc »

And don't forget to delete the memory afterwards.

Post Reply