digitalmars.D.internals - DIP1000 simple scopebuffer
- Walter Bright (12/12) Oct 24 2016 @safe struct ScopeBuffer
- Mathias Lang (5/18) Oct 24 2016 Could you provide an usage example of something that doesn't
- Walter Bright (2/3) Oct 24 2016 What Dicebot asked for was an example of a scopebuffer.
- Walter Bright (2/5) Oct 24 2016 http://www.digitalmars.com/d/archives/digitalmars/D/internals/DIP1000_di...
- =?UTF-8?B?Tm9yZGzDtnc=?= (3/4) Jan 16 2017 How does this differ from an opIndex() qualified as `return
- Walter Bright (2/5) Jan 16 2017 Scope refers to the value, ref refers to the address of the container of...
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.
Oct 24 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.
Oct 24 2016
On 10/24/2016 3:16 PM, Mathias Lang wrote:The snippet you pasted already compiles, and doesn't use `scope` at all.What Dicebot asked for was an example of a scopebuffer.
Oct 24 2016
On 10/24/2016 3:16 PM, Mathias Lang wrote: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.http://www.digitalmars.com/d/archives/digitalmars/D/internals/DIP1000_discussion_and_testing_3.html#N63
Oct 24 2016
On Monday, 24 October 2016 at 21:02:05 UTC, Walter Bright wrote:ref int opIndex(size_t i) returnHow does this differ from an opIndex() qualified as `return scope`?
Jan 16 2017
On 1/16/2017 2:29 AM, Nordlöw wrote:On Monday, 24 October 2016 at 21:02:05 UTC, Walter Bright wrote:Scope refers to the value, ref refers to the address of the container of the value.ref int opIndex(size_t i) returnHow does this differ from an opIndex() qualified as `return scope`?
Jan 16 2017