Is there something like anonymous struct?
Steven Schveighoffer
schveiguy at yahoo.com
Tue Mar 5 08:02:49 PST 2013
On Mon, 04 Mar 2013 21:58:57 -0500, eGust <egustc at gmail.com> wrote:
> On Tuesday, 5 March 2013 at 02:15:33 UTC, anonymous wrote:
>> On Tuesday, 5 March 2013 at 02:01:47 UTC, eGust wrote:
>>> Can I write something like this:
>>>
>>> __gshared immutable foo = {
>>> auto
>>> func1 = &fn1,
>>> func2 = &fn2,
>>> ...
>>> }
>>>
>>> Or just
>>>
>>> ... = {
>>> &fn1, &fn2, ...
>>> }
>>
>> import std.typecons: tuple;
>> __gshared immutable foo = tuple(&fn1, &fn2, ...);
>
> Yes, it looks better. Can tuple guarantee the order and alignment of the
> elements? I need an interface with other languages.
It will be equivalent to a struct declared with those members.
However, I would say if you are looking for a type to push across
languages, why not declare the type?
-Steve
More information about the Digitalmars-d
mailing list