add enumutils.items for sparse enums, typetraits.SomeSparseEnum (#17080)

* add enumutils.items for enum with holes
* changelog
* ref in lib.rst
* use `type SomeSparseEnum* = (not Ordinal) and enum` instead of concept
* address comment: rename back to enum with holes
This commit is contained in:
Timothee Cour
2021-02-23 11:25:35 -08:00
committed by GitHub
parent 74a8f23801
commit c274e67198
6 changed files with 58 additions and 6 deletions

View File

@@ -0,0 +1,16 @@
discard """
targets: "c js"
"""
import std/enumutils
from std/sequtils import toSeq
template main =
block: # items
type A = enum a0 = 2, a1 = 4, a2
type B[T] = enum b0 = 2, b1 = 4
doAssert A.toSeq == [a0, a1, a2]
doAssert B[float].toSeq == [B[float].b0, B[float].b1]
static: main()
main()