Version 2.0.0 of FixedString, my @safe @nogc nothrow array type, has been released.
This version is mostly compatible with 1.2.0, but the helper template FixedString!"foo"
has been changed to fixedString!"foo"
to comply with the standard D style convention. Furthermore, the range api has been totally overhauled; in particular, opIndex()
now returns a range (random access, with slicing) rather than a raw slice, and the functions empty()
, front()
, and popFront()
have thus been removed from the container.
Previously, it was possible to modify out-of-bounds elements with opIndex
if the maximum size of the FixedString
would allow it. This behaviour does not align with that of native dynamic arrays, however, so it has been removed. The correct way to perform this action is to either use the ~=
operator, or alternatively set the length to an appropriate value beforehand.
It is now possible to use FixedString with types that use the garbage collector, throw, or have otherwise unsafe behaviour, as the element type. This was impossible in 1.x.x as almost every function had the @nogc nothrow pure @safe
attributes applied. However, templates in D automatically infer their attributes - meaning this restriction was unnecessary. As such, it has been lifted.
There have also been a number of fixes.
opAssign
,opOpAssign
,opEquals
,concat
andopBinary
all assumed they would only ever be used with thechar
element type. This oversight has been fixed.opSlice
is now bounds checked.
And finally, FixedString is now compatible with dip1000.