On Saturday, 12 July 2014 at 19:16:52 UTC, Danyal Zia wrote:
On Saturday, 12 July 2014 at 19:09:44 UTC, seany wrote:
Please consider the following
struct arc(T,U)
{
T some_var;
U someother_var;
}
/* things */
class myclass
{
this(){}
~this(){}
void MYfunction()
{
arc!(string, string[]) * a;
a.some_var = "hello";
}
}
void main()
{
c = new myclass();
c.MYfunction();
}
This leads to a segmentation fault.
What am I doing wrong?
"a" has not been instantiated. You are declaring it as a
pointer to struct and using its fields without initializing it.
"arc!(string, string[]) a;" will work.
For reasons further down in the software, I need to do this with
a pointer. How do I do it with a pointer, please?