[llvm] [ADT] Implement EnumeratedArray with std::array (NFC) (PR #158407)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 13 13:50:11 PDT 2025


kazutakahirata wrote:

> > @kuhar I added `static_assert` to disallow 0-sized arrays.
> 
> Why not allow them? Is that because it would imply no enum values at all?

@kuhar Right, and there is no use case.  Given the template parameters and their default values, someone would need to work hard and specify all the template parameters to set `Size` to 0.

```
template <typename ValueType, typename Enumeration,
          Enumeration LargestEnum = Enumeration::Last, typename IndexType = int,
          IndexType Size = 1 + static_cast<IndexType>(LargestEnum)>
```


https://github.com/llvm/llvm-project/pull/158407


More information about the llvm-commits mailing list