<div dir="ltr"><div style>Thank you @Ali and @Jonothan!<br></div><div style><br></div><div style>So essentially since I will be storing a pointer, Telemetry!(T) is NOT safe to use only with structs in general.</div><div style>
<br></div><div style>If I have something like:</div><div style><br></div><div style><span style="font-family:arial,sans-serif;font-size:13px">struct UsefulStruct2</span><br></div><span style="font-family:arial,sans-serif;font-size:13px">{</span><div>
<font face="arial, sans-serif"> </font>this(this) @disable;</div><div> this(<span style="font-family:arial,sans-serif;font-size:13px">UsefulStruct2</span>) @disable;<div><div><span style="white-space:pre"> </span>this(ref const(<span style="font-family:arial,sans-serif;font-size:13px">UsefulStruct2</span>)) @disable;</div>
<div><span style="white-space:pre"> </span>ref <span style="font-family:arial,sans-serif;font-size:13px">UsefulStruct2</span> opAssign(<span style="font-family:arial,sans-serif;font-size:13px">UsefulStruct2</span>) @disable;</div>
<div><span style="white-space:pre"> </span>ref <span style="font-family:arial,sans-serif;font-size:13px">UsefulStruct2</span> opAssign(ref const(<span style="font-family:arial,sans-serif;font-size:13px">UsefulStruct2</span>)) @disable;</div>
<div><br></div><span style="font-family:arial,sans-serif;font-size:13px"> int importantValue;</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> auto tel1 = Telemetry!int(importantValue);</span><div>
<div><span style="font-family:arial,sans-serif;font-size:13px">}</span><br></div></div></div></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Does that ensure that UsefulStruct2 is not relocateable and thus I can safely store a pointer to importantValue?</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">If not, what constraints do I need to add to my classes to ensure that I don't run into subtle bugs when structs relocate?</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><font face="arial, sans-serif">Regards,</font></div><div style><font face="arial, sans-serif">Saurabh Das</font></div></div>