Original Post
Hi all - I'm working on a font system for my engine, and I've run into a strange constructor issue with std::vector. It occurs to me that I'm doing some rather complicated stuff here, but I don't think I'm doing anything "illegal." Can someone give me a push in the right direction? Here's a slice of my code - I'm getting a crash when it tries to initialize a FontChar in the BitmapFont constructor. Specifically, it's crashing in the "Buy" method for the "KPairs" vector, telling me that there's a corrupt block somewhere. I'm using VS 2003, and I know that Visual Studio historically has problems with their STL implementations, but it's also possible that I'm screwing something up here. Can anyone see anything wrong? Thanks for the help!
class BitmapFont
{
struct FontChar
{
FontChar(): x(0),y(0),Width(0),Height(0),XOffset(0),YOffset(0),XAdvance(0),Page(0)
{}
uint16 x, y; // represent pixel coords in the texture
uint16 Width, Height; // of the char in the texture
int16 XOffset, YOffset; // for the desitnation rect
uint16 XAdvance; // for rendering
uint16 Page; // Unused for now (only support 1 page fonts)
//Pairs for which I am the SECOND character. - makes iteration easier
std::vector<KerningPair> KPairs;
};
FontChar chars[256];
};