tcompiletimerange.nim 530 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. """
  3. # issue #8199
  4. const rangesGCHoldEnabled = true # not defined(rangesDisableGCHold)
  5. type
  6. # A view into immutable array
  7. Range*[T] {.shallow.} = object
  8. when rangesGCHoldEnabled:
  9. gcHold: seq[T] # 0
  10. start: ptr T # 1
  11. mLen: int32 # 2
  12. type
  13. BytesRange* = Range[byte]
  14. NibblesRange* = object
  15. bytes: BytesRange
  16. const
  17. zeroBytesRange* = BytesRange()
  18. proc initNibbleRange*(bytes: BytesRange): NibblesRange =
  19. result.bytes = bytes
  20. const
  21. zeroNibblesRange* = initNibbleRange(zeroBytesRange)