D Ranges

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Sep 15 06:21:23 PDT 2013


15-Sep-2013 17:02, monarch_dodra пишет:
> It depends how you look at it. If the original intent was to have a type
> with reference semantics, because your value type was so damn big (eg,
> PRNG), then that would *not* be OK (and the original point I was making
> that RefCounted is a bad contender for "just" reference semantics).
>

If user don't have the access to the wrapped internal type there should 
be no problem. E.g. the wrapped type is private and only usable inside 
the PRNG's module. Then having public alias for RefCounted!PRNG touted 
as THE PRNG should suffice. (Truly wicked folks can crack open it with a 
carefully applied piece of template deduction but each to their own goals).


If you are afraid of these dark mages of templates you can do something 
like:

struct RefPRNG{
	RefCounted!PRNG payload;
	mixin ForwardCallsTo!"payload";
}

And let them suck it down. IMHO there is no reason to go that far.

> If you are *trully* using it for deterministic finalization, then yeah,
> it's OK.

See above I don't see the problem.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list