Is it possible to initialize array of structures in bulk in SIL script ?
For example
struct Subtask_struct {
string summary;
string description;
string reporter;
string assignee;
};
Subtask_struct[] subtasks = {
{"summary1", "description1", "reporter1", "assignee1"},
{"summary2", "description2", "reporter2", "assignee2"}
};
The code above returns me error saying it is not possible to convert string[][] to Subtask_struct[]
@RVal, you can defiantly do something like this:
struct Subtask_struct {
string summary;
string description;
string reporter;
string assignee;
};
Subtask_struct issue1 = {"summary1", "description1", "reporter1", "assignee1"};
Subtask_struct issue2 = {"summary2", "description2", "reporter2", "assignee2"};
Subtask_struct issue3 = {"summary3", "description3", "reporter3", "assignee3"};
Subtask_struct[] subtasks = {issue1, issue2, issue3};
Does that help?
Yes I ended up doing doing something like that but it seams very verbose with lots of code repetitions and does not look good when you need 100th elements in the list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.