Formal review of std.buffer.scopebuffer
monarch_dodra
monarchdodra at gmail.com
Mon Mar 17 12:03:52 PDT 2014
On Monday, 17 March 2014 at 18:37:07 UTC, Walter Bright wrote:
> On 3/17/2014 7:33 AM, monarch_dodra wrote:
>> The fix for pointers hasn't been integrated.
>> "ScopeBuff!(int*)" still doesn't
>> compile.
>
> I had fixed that.
>
> import std.internal.scopebuffer;
>
> void main() {
> alias ScopeBuffer!(int*) T;
> }
>
> compiles.
@walter: You fixed it by casting away the const in the
implementation. It didn't even cross my mind you'd fix it like
that, so when I looked at the pulled code, I just saw
"put(const(T)[] arr)", and figured it wasn't "fixed". My
apologies for claiming your code doesn't compile.
So yes, it compiles, but the implementation is still wrong. Your
implementation allows assigning an immutable(int)* into an int*.
Unless there is a performance specific reason for using the
const, I don't see why we aren't removing it.
More information about the Digitalmars-d
mailing list