title: Tracking reference in C++/CLI
body: <p>Can someone please explain me the following code snippet?</p>
  
  <pre><code>value struct ValueStruct {
      int x;
  };
  
  void SetValueOne(ValueStruct% ref) {
      ref.x = 1;
  }
  
  void SetValueTwo(ValueStruct ref) {
      ref.x = 2;
  }
  
  void SetValueThree(ValueStruct^ ref) {
      ref-&gt;x = 3;
  }
  
  ValueStruct^ first = gcnew ValueStruct;
  first-&gt;x = 0;
  SetValueOne(*first);
  
  ValueStruct second;
  second.x = 0;
  SetValueTwo(second); // am I creating a copy or what? is this copy Disposable even though value types don't have destructors?
  
  ValueStruct^ third = gcnew ValueStruct;
  third-&gt;x = 0;
  SetValueThree(third); // same as the first ?
  </code></pre>
  
  <p>And my second question is: is there any reason to have something like that?:</p>
  
  <pre><code>ref struct RefStruct {
      int x;
  };
  
  RefStruct% ref = *gcnew RefStruct;
  // rather than:
  // RefStruct^ ref = gcnew RefStruct;
  
  // can I retrieve my handle from ref?
  // RefStruct^ myref = ???
  </code></pre>
  
  <p>What is more: I see no difference between value type and ref type, since both can be pointed by handler ;(</p>