ReturnType and overloaded functions

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 13 09:13:09 PDT 2015


On Fri, 12 Jun 2015 17:28:56 -0700, Ali Çehreli wrote:

>>> void main()
>>> {
>>>       static assert(is (ReturnType!(() => foo(long.init)) == int));
>>>       static assert(is (ReturnType!(() => foo(byte.init)) == short));
>>> }
>>>
>>> Ali
>>
>> or without importing `std.traits`:
>>
>>    static assert(is(typeof(foo(long.init)) == int)); static
>>    assert(is(typeof(foo(byte.init)) == short));
>>
>>
> Good point. :) What is the difference of ReturnType then?

i don't know. it looks nicer, maybe. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150613/ff35eb30/attachment.sig>


More information about the Digitalmars-d mailing list