www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14830] New: RefCounted does not forward all fields of


          Issue ID: 14830
           Summary: RefCounted does not forward all fields of underlying
                    data structure
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: joseph.wakeling webdrake.net

Observed when trying to create a ref-counted random number generator:

    import std.random, std.typecons;
    static assert(isUniformRNG!Random);
    static assert(isUniformRNG!(RefCounted!Random)); // FAILS

So far as I can tell, the problem is the check for the existence of the
isUniformRandom boolean enum in the isUniformRNG template check:

i.e. while this check passes:

    static assert(is(typeof(Random.isUniformRandom)));

this corresponding one fails:

    static assert(is(typeof((RefCounted!Random).isUniformRandom)));

Clearly one could put the blame on the isUniformRNG template check here, but my
feeling is that RefCounted should be able to forward _all_ properties and
fields of the underlying type, including compile-time enum flags like

Jul 26 2015