Is it possible to modify shared struct array in a function.
Sudhi
sudheendra.malli at gmail.com
Fri Feb 8 04:13:39 UTC 2019
I have a situation, where i want to modify a shared variable in a
function. Something like below
struct Company
{
string name;
string location;
}
struct Racks
{
int number;
int location;
}
struct Metadata
{
string name;
Company[] companies;
Racks[] racks;
}
struct Item
{
Metadata met;
int count;
}
shared (Item) item
void main()
{
updateMetadata()
}
void updateMetadata()
{
Company company;
company.name = "Hello";
company.location = "Bangalore";
item.met.companies ~= company;
}
Compiler throws me error in last line for appending as below.
"cannot append type Metadata to type shared(Metadata[])".
Please let me know if there is a way to acheive this.
Thanks,
Sudhi
More information about the Digitalmars-d-learn
mailing list