2.011 invariant question
Janice Caron
caron800 at googlemail.com
Sat Feb 23 08:43:20 PST 2008
On 23/02/2008, Janice Caron <caron800 at googlemail.com> wrote:
> struct Buffer!(T)
> {
> private T[] array;
> private uint reserved;
> void opCatAssign() {...}
> T[] toArray() {...}
> const(T)[] toCArray() {...}
> invariant(T)[] toIArray() {...}
> /*etc*/
> }
Actually, I think we could simplify that interface to:
struct Buffer!(T)
{
private T[] array;
private uint reserved;
void opCatAssign() {...}
T[] toArray() {...}
}
because if you want to return a const or invariant array, you'd just
have to change the initial declaration of the Buffer. As in
Buffer!(invariant(char)) instead of Buffer!(char).
More information about the Digitalmars-d
mailing list