equivariant functions
Max Samukha
samukha at voliacable.com.removethis
Sun Oct 12 23:13:58 PDT 2008
On Sun, 12 Oct 2008 16:45:49 -0500, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
>Walter Bright wrote:
>> Hmm. Given:
>>
>> typeof(s) foo(long s);
>> auto x = foo(1);
>>
>> is x going to be declared as an int?
>
>int is neither a supertype or a subtype of long.
>
>Andrei
Are typedefs subtypes of the type they are based on?
typedef int Bar;
typeof(s) foo(Bar s);
auto x = foo(1); // is x int?
What will be the type of a typeof(s) inside the function?
typeof(s) foo(const(char)[] s)
{
alias typeof(s) T; // what type is T?
}
More information about the Digitalmars-d
mailing list