I have my own class that describes some mathematical vector of complex numbers. Wherein a real and complex parts of it are stored separately.
class Vector{
private:
unsigned int dim; //dimensionality of vector
double* real;
double* imag;
};
I knowingly don't use a single array of std::complex<double>
because inside the Vector
there are some high performance routines which work with a real and complex parts of vector separately.
Now I want to implement an iterator that should return pointer to an appropriate elements of my vector and should has type std::complex<double>
.
In other words the question is "how to organize an access to two coupled arrays through iterator of different type?"
Of course I don't want to store an additional array of std::complex
as well as to do a conversion from my arrays to required one during calling of the iterator.
Please help me to implement just some basic operations such as begin()
and end()
.