Answer the question
In order to leave comments, you need to log in
Class for an enum with a given type in C++?
If in С++ to do enum operation = {plus, minus, mult, div};
Then the enumerable constants will have type operation.
What if I need the operation variable to be of type char, and can only take the values {'+', '-', '*', '/'} ?
Is there any container in std/Qt/boost/other library that allows you to do something along the lines of:
Enumeration<char> operation = {'+', '-', '*', '/'};
Enumeration<Operator, Operand, Bracket> Token = {op, num, br};
Answer the question
In order to leave comments, you need to log in
An arbitrary enumeration type is available without third-party libraries, the declaration is similar to the definition of a child of the parent class:
enum YourType : Type {}
For example, for a symbolic
enum MySymbol : char { Minus = '-', plus = '+' }
MSDN https://msdn.microsoft .com/ru-ru/library/2dzy4k6e.aspx
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question