|
|
|
|
|
by dwattttt
390 days ago
|
|
> There are easy ways to implement stuff like enums with members in C++, just put an anonymous enum inside a class/struct, its possible but marked as not possible. This guide does exactly that in C++ for methods on enums. For members, won't this result in all instances of an "enum" having all fields? That's not really comparable to Rust enums, if that's what you mean. |
|
Rust enums are not enums, they are tagged unions and there is a C++ equivalent, std::variant which was discussed. It’s not got nice tooling around it like match but it exists and can be used identically.