Skip to content

Add len type generic param#10

Open
elcritch wants to merge 7 commits into
termermc:masterfrom
elcritch:add-configurable-len
Open

Add len type generic param#10
elcritch wants to merge 7 commits into
termermc:masterfrom
elcritch:add-configurable-len

Conversation

@elcritch

@elcritch elcritch commented May 3, 2025

Copy link
Copy Markdown

Makes a new base type StackStringBase[T; Size: static Natural] that has a generic parameter for the string length size.

For backwards compatibility purposes, StackString[N: static Natural] is defined as a type alias type StackString*[Size: static Natural] = StackStringBase[Natural, Size].

There is a compile time check in the constructor functions (like stackStringOfCap) that gives a compile time error if T is not large enough to hold Size characters. Unfortunately I couldn't find a way get the compiler to do the check in the type itself.

@termermc

termermc commented May 9, 2025

Copy link
Copy Markdown
Owner

I've been pretty busy recently, I'll review and test this out when I wake up tomorrow. Sorry for the delay, and thank you for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants