Could our CC gurus have a quick look on the effort needed to support strong enums types (feature from C++0x).
Here's a little code snippet :
enum class StrongEnum1
{
on,
off
};
enum class StrongEnum2
{
on,
off
};
int main()
{
StrongEnum1 value1;
value1 = StrongEnum1::on;
return 0;
}
Current situation.
While typing the line "value1 = StrongEnum1::on;" :
- StrongEnum1 does not give a completion suggestion, due to this it has to be typed completely manually
- StrongEnum1:: does not provide a suggestion list of the possible enum values.
What do you guys think ?
just found one little hickup.
When I tooltip over the enum class type, the tooltip shows 2 things :
enum Foo {}
class Foo {}
where it should only show :
enum class Foo {}
Note from time to time, it only says enum Foo. A bit weird.
should show "enum Foo". I just reviewed the rev6759, loaden just eat the "class" keyword after enum. so
enum class StrongEnum1
{
on,
off
};
is indeed becomes:
enum StrongEnum1
{
on,
off
};
NOtice something else, when hovering over a struct it also says :
class FooStruct, where I guess we should say : struct FooStruct , right ?
confirmed, I think this can be fixed easily, I will look into it right now.
NOtice something else, when hovering over a struct it also says :
class FooStruct, where I guess we should say : struct FooStruct , right ?
confirmed, I think this can be fixed easily, I will look into it right now.
oh, I found that there is not "struct" Token...
see the declaration:
enum TokenKind
{
// changed in order to reflect the priority
tkNamespace = 0x0001,
tkClass = 0x0002,
tkEnum = 0x0004,
tkTypedef = 0x0008, // typedefs are stored as classes inheriting from the typedef'd type (taking advantage of existing inheritance code)
tkConstructor = 0x0010,
tkDestructor = 0x0020,
tkFunction = 0x0040,
tkVariable = 0x0080,
tkEnumerator = 0x0100,
tkPreprocessor = 0x0200,
tkMacro = 0x0400,
// convenient masks
tkAnyContainer = tkClass | tkNamespace | tkTypedef,
tkAnyFunction = tkFunction | tkConstructor | tkDestructor,
// undefined or just "all"
tkUndefined = 0xFFFF
};
so, the "struct" is recorded as "class"...
not easy to change, because we need to change a lot if we add a new "struct" type.