DIP1000: Scoped Pointers
Walter Bright via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Aug 12 12:37:47 PDT 2016
On 8/12/2016 5:54 AM, Joseph Rushton Wakeling wrote:
> On Friday, 12 August 2016 at 12:51:26 UTC, Joseph Rushton Wakeling wrote:
>> I'm not sure I follow. I'm looking for the ability to guarantee that a
>> pointer to a stack-allocated entity will not go out of scope
>
> ... more precisely, that the pointer will not become invalid because the data it
> points to goes out of scope.
>
That's just what this DIP addresses.
struct MyWrapperStruct (T)
{
private T* data;
public this (ref T input)
{
this.data = &input; // error: not allowed to take address of ref
variable
}
}
The DIP does not add ownership annotations or semantics.
More information about the Digitalmars-d-announce
mailing list