[Dlang-internal] DIP1000 simple scopebuffer

Mathias Lang via Dlang-internal dlang-internal at puremagic.com
Mon Oct 24 15:16:44 PDT 2016


On Monday, 24 October 2016 at 21:02:05 UTC, Walter Bright wrote:
> @safe struct ScopeBuffer
> {
>   private:
>     int[10] buffer;
>
>   public:
>     ref int opIndex(size_t i) return
>     {
>         return buffer[i];
>     }
> }
>
> Yes, a real one would be more complex, but that's the basic 
> idea. The ref returns are tied to the instance of the 
> ScopeBuffer.

Could you provide an usage example of something that doesn't 
compile currently, and will compile with your P.R. ?
The snippet you pasted already compiles, and doesn't use `scope` 
at all.


More information about the Dlang-internal mailing list