-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Thanks for the library! What do you think about making lenInternal customizable to different int types? Alternatively the smallest lenInternal size could be figured out at compile time.
I've been using it more lately for UI and CSS libraries only need ~60 letters for strings. That means Natural is as large as the text itself on a 64bit platform. :/
One way to do it automatically might be like:
type StackString*[Size: static Natural] = object
## A stack-allocated string with a fixed capacity
when Size <= uint8.high():
lenInternal: uint8
elif Size <= uint16.high():
lenInternal: uint16
elif Size <= uint32.high():
lenInternal: uint32
elif Size <= uint64.high():
lenInternal: uint64
else:
{.error: "size is too large to be stored: " & $Size.}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels