mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-22 23:35:22 +00:00
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:
16
tests/stdlib/tenumutils.nim
Normal file
16
tests/stdlib/tenumutils.nim
Normal 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()
|
||||
Reference in New Issue
Block a user