Skip to content

a safe, nogc-compatible templated array type, originally for strings.

License

Notifications You must be signed in to change notification settings

Moth-Tolias/fixedstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fixedstring

a templated fixed-length array of chars, compatible with @safe, @nogc, and nothrow code.

example

void main() @safe @nogc nothrow
{
	FixedString!14 foo = "clang";
	foo[0] = 'd';
	foo ~= " is cool";
	assert(foo == "dlang is cool");

	foo.length = 9;

	immutable bar = fixedString!"neat";
	assert(foo ~ bar == "dlang is neat");

	// wchars and dchars are also supported
	assert(FixedString!(5, wchar)("áéíóú") == "áéíóú");

	// in fact, any type is:
	immutable int[4] intArray = [1, 2, 3, 4];
	assert(FixedString!(5, int)(intArray) == intArray);
}

read the documentation for more info!

licence

AGPL-3.0 or later

About

a safe, nogc-compatible templated array type, originally for strings.

Topics

Resources

License

Stars

Watchers

Forks

Languages