>> token[0] = a; token[1] = '\0';
That's a really bad idea. You don't add characters to an std::string that way. Use string:ush_back(char) or string:perator += (const char*). Furthermore, you should *never* terminate, resize, append, or otherwise alter the dimensions of an std::string manually (so no strcpy, strcat, etc). Always use the appropriate member functions for those sorts of operations.
Anyway, here is an example of using a vector for your data structure:
Code:
class Token {
public:
std::string token;
int opcode;
bool type;
static vector<Token> Tokens;
void init(std::string a, int b, bool c)
{
token = a;
opcode = b;
type = c;
Tokens.push_back(*this);
}
Token(std::string a, int b, bool c)
{
init(a, b, c);
}
Token(char a, int b, bool c)
{
char temp[2] = {a, 0};
init(temp, b, c);
}
};