[enhancement] variant_count!<> builtin
Open
dslx
enhancement
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
### What's hard to do? (limit 100 words)
Similar to `u32::MAX`, it would be nice to have a way to get the number of elements in an enum. Similar to rust's [std::mem::variant_count](https://doc.rust-lang.org/std/mem/fn.variant_count.html).
### Current best alternative workaround (limit 100 words)
Make a const yourself and hope you keep it up to date.
### Your view of the "best case XLS enhancement" (limit 100 words)
A builtin `std::variant_count!<>` or a colon-ref (like `u32::MAX`), e.g. EnumType::NUM_VARIANTS.
Contributor guide
Assessment
This issue has not been assessed yet.