mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
* 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
17 lines
312 B
Nim
17 lines
312 B
Nim
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()
|