Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
On Friday, 4 May 2018 at 15:37:28 UTC, ag0aep6g wrote: On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: How can I use the following c structure from d. struct Item { int id; }; struct Group { int i; int item_count; struct Item items[]; }; tried defining items[] as both "Item[] it

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
On Friday, 4 May 2018 at 14:55:18 UTC, Timoses wrote: On Friday, 4 May 2018 at 13:27:03 UTC, NewUser wrote: Hi Timoses, The structure is being returned from c and I'd like use it from d. What you have work perfectly when assigning from d. Regards, NewUser Then you probably need some `ext

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:21:53 UTC, Timoses wrote: On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but gives an error when trying to access it. You were on the right track. D array notation is: []

using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
Hi, How can I use the following c structure from d. struct Item { int id; }; struct Group { int i; int item_count; struct Item items[]; }; tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but gives an error when trying to access it. Here is the

Re: Passing to c++ std::string and vector

2018-04-30 Thread NewUser via Digitalmars-d-learn
On Monday, 30 April 2018 at 10:48:40 UTC, Jonathan M Davis wrote: On Monday, April 30, 2018 01:07:35 NewUser via Digitalmars-d-learn wrote: Hi, How do I pass a d string to a c++ std::string? The most straightforward way would be to create a C or C++ function which accepts const char* and

Passing to c++ std::string and vector

2018-04-29 Thread NewUser via Digitalmars-d-learn
Hi, How do I pass a d string to a c++ std::string? NewUser