Formal review of std.buffer.scopebuffer

David Eagen davideagen at mailinator.com
Sun Mar 16 15:47:46 PDT 2014


I've started using it in a project to replace a simple dynamic 
array buffer and so far it has fit my needs very well. One thing 
I ran into was a method in the project's API that has this 
signature:

const(ubyte[]) foo() const

I couldn't return a slice from ScopeBuffer directly because of 
the const. I resolved it by changing opSlice's signature in 
ScopeBuffer to this:

@system inout(T[]) opSlice() inout

So there are two questions:

1.) Is this a good way to resolve the problem or am I doing 
something horribly wrong?
2.) Assuming this isn't horribly wrong should ScopeBuffer use 
inout like this?


More information about the Digitalmars-d mailing list