https://github.com/moth-tolias/fixedstring
a safe, nogc-compatible templated array type, originally for strings.
https://github.com/moth-tolias/fixedstring
d dlang nogc
Last synced: 4 months ago
JSON representation
a safe, nogc-compatible templated array type, originally for strings.
- Host: GitHub
- URL: https://github.com/moth-tolias/fixedstring
- Owner: Moth-Tolias
- License: agpl-3.0
- Created: 2021-11-06T06:08:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-24T21:26:25.000Z (over 3 years ago)
- Last Synced: 2025-08-19T22:32:57.832Z (5 months ago)
- Topics: d, dlang, nogc
- Language: D
- Homepage:
- Size: 47.9 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# fixedstring
a templated fixed-length array of `char`s, compatible with `@safe`, `@nogc`, and `nothrow` code.
# example
```d
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](https://fixedstring.dpldocs.info/fixedstring.html) for more info!
# licence
AGPL-3.0 or later