我正在用 c++/clr 编写程序,我需要编写词法分析器。我有这些:
std::map <std::string, int> classes = { { "keyword",0 },{ "identifier",0 },{ "digit",0 },{ "integer",0 },{ "real",0 },{ "character",0 },{ "alpha",0 } };
std::vector<std::string> ints = { "0","1","2","3","4","5","6","7","8","9" };
std::vector<std::string> keywords = { "if","else","then","begin","end" };
std::vector<std::string> identifiers = { "(",")","[","]","+","=",",","-",";" };
std::vector<std::string> alpha = { "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z" };
std::vector<std::string>::iterator iter;
Run Code Online (Sandbox Code Playgroud)
所以现在的问题是:它标志着classes,ints,keywords等为错误:
a member of managed class cannot be of a non-managed class type
我怎样才能解决这个问题?
c++-cli ×1