Generality creep
    Kagamin 
    spam at here.lot
       
    Wed Mar 20 17:41:18 UTC 2019
    
    
  
On Tuesday, 19 March 2019 at 14:08:24 UTC, Steven Schveighoffer 
wrote:
> The problem is a simple one: typeof(a.length) is not size_t, 
> but a function type.
>
> If you put @property on the length function it would work, but 
> I think we should not require that.
>
> -Steve
struct S
{
    size_t length() const { return 0; }
}
auto ref property(T)(auto ref T a){ return a; }
void f()
{
    S s;
    assert(s.length == 0); //OK
    static assert(is(typeof(property(s.length))==size_t));
}
Can this work?
    
    
More information about the Digitalmars-d
mailing list