Oh, sorry STL->std (bad human memory).
By "what syntax", I just meant what does your code look like. Yes, the line you wrote is the syntax I was trying to remember and suggest to you. Good job.
Yes, so the syntax for that would be something like:
Code:
// In the class definition file e.g. NarfClass.h
class NarfClass
{
// Constructor:
NarfClass( std::vector<Character> * pCVectorToUse );
// Method that does something with CVector:
void DoStuffWithCVector();
// The static storage of the Character Vector:
static std::vector<Character> * pCVector;
};
Code:
// In the class definition file e.g. NarfClass.cpp
#include "NarfClass.h"
NarfClass::NarfClass( std::vector<Character> * pCVectorToUse )
{
pCVector = pCVectorToUse;
}
void NarfClass:
oStuffWithCVector()
{
int NumberOfCharactersInGame = pCVector->size();
// etc...
}
Code:
// In the class that stores the whole gamestate:
#include "NarfClass.h"
// The actual vector:
static std::vector<Character> CVector;
// The creation of a NarfClass object:
NarfClass NarfsNarf( &CVector );
// Now NarfsNarf is an object that can do stuff with CVector.
NarfsNarf.DoStuffWithCVector();
I may have a typo or be missing something, but that's about how I'd do it.
PvK