Generic collection/element function signatures in D2 versus D1
Steven Schveighoffer
schveiguy at yahoo.com
Tue Sep 7 05:49:53 PDT 2010
On Sun, 05 Sep 2010 09:40:59 -0400, BLS <windevguy at hotmail.de> wrote:
> On 05/09/2010 02:16, Jonathan M Davis wrote:
>> void foo(T)(T[] collection, T elem)
>>> {
>>> // Blah, whatever
>>> }
>>>
>
> I am curious, how this will look and feel once inout is working ?
>
> inout void foo(T)(inout(T)[] collection, inout T elem)
> {
> // Blah, whatever}
> }
>
inout void doesn't make any sense. You can't have a const void or
immutable void.
Now, if foo is a member function, then inout applies to the "this"
pointer, but even then, you need a return type other than void for inout
to be used.
-Steve
More information about the Digitalmars-d-learn
mailing list