C
colin
Hi,
I need to convert between 2 identical structs,
but they are both in seperate libraries and so I cant just edit either
one of them to add explicit operators.
they are both 3d vectors, one is the managed directx Vector3,
containing float X,Y,Z, and the other is identical also containing float
X,Y,Z,
wich is also in a seperate library.
Idealy I need to be able to use any number of libraries wich
obtain the vector information I want wich each have their own definition of
Vector3
and to use any number of graphic linraries such as managed directx,
or Opengl binding etc, I also have my own graphics maths library wich uses a
vector3 wich I need to implement with both float and double vector3's.
I could have an interim struct wich has the converters,
but im wondering if theres a clever way posibly using TypeConverter ?
at the moment I have an overloaded static function wich does the conversion.
but it would be nice if I could pass the struct by reference and avoid any
copying where the structures are truly identical,
generics dont seem to be flexible enough to allow me to do what I need.
ie i cant access the X element inside a generic.
thanks
Colin =^.^=
I need to convert between 2 identical structs,
but they are both in seperate libraries and so I cant just edit either
one of them to add explicit operators.
they are both 3d vectors, one is the managed directx Vector3,
containing float X,Y,Z, and the other is identical also containing float
X,Y,Z,
wich is also in a seperate library.
Idealy I need to be able to use any number of libraries wich
obtain the vector information I want wich each have their own definition of
Vector3
and to use any number of graphic linraries such as managed directx,
or Opengl binding etc, I also have my own graphics maths library wich uses a
vector3 wich I need to implement with both float and double vector3's.
I could have an interim struct wich has the converters,
but im wondering if theres a clever way posibly using TypeConverter ?
at the moment I have an overloaded static function wich does the conversion.
but it would be nice if I could pass the struct by reference and avoid any
copying where the structures are truly identical,
generics dont seem to be flexible enough to allow me to do what I need.
ie i cant access the X element inside a generic.
thanks
Colin =^.^=