Swift, C++ and structs
<p>I need to send a Swift <code>struct</code> consisting of two floats to some C++ code. </p>

<h3>Swift struct</h3>

<pre><code>struct ComplexNumber
{
   var real: Float
   var imaginary: Float
}
</code></pre>

<h3>C++ method signature</h3>

<pre><code>void processComplexNumbers(const ComplexNumber *complexNumbers, const int *indices);
</code></pre>

<p>I have typedef'd the same struct in C++.</p>

<p>When I try to call this from Swift I get the error cannot convert value from <code>UnsafePointer&lt;ComplexNumber&gt;</code> to expected argument type <code>UnsafePointer&lt;ComplexNumber&gt;</code>. The following code is a simple illustration of this error.</p>

<pre><code>var samples = [ComplexNumber]()
var indices = [Int]()
var samplesPtr = UnsafePoiner&lt;ComplexNumber&gt;(samples)
var indices = UnsafePoiner&lt;Int&gt;(indices)
processComplexNumbers(samples, indices)
</code></pre>

<p>Why can't I get this to work and is there a workaround?</p>