DIP1000: Scoped Pointers

Guillaume Chatelet via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Aug 14 03:11:25 PDT 2016


On Saturday, 13 August 2016 at 20:50:53 UTC, Joseph Rushton 
Wakeling wrote:
> The TL;DR here is that I'm concerned about having a solution 
> for random number generators and random algorithms that (i) 
> allows them to be stack-allocated, (ii) ensures that their 
> internal state is not accidentally copied by value, and (iii) 
> allows them to work effectively with (input) range semantics.

Isn't it what a scoped class is supposed to provide?

class Rnd {}

void foo() {
   scope rnd  = new Rnd; // reference semantic and stack allocated
}


More information about the Digitalmars-d-announce mailing list