I have struct Token
, to which I'm trying assign operator=. I wanna be able to assign to char. I tried char operator=(const Token& token){ return token.kind; }
, which throws error, says is not unary operator, tried char operator=(const char& ch, const Token& token){ return token.kind; }
didn't help either. Yes I can do just char ch { token.kind };
, but I wanna do it through operator in case if add some logic. Can you help me?
struct Token {
char kind;
int value;
Token(char kind, int value): kind(kind), value(value){}:
}