Unfortunately, automatic conversion operators must be defined as a non-static member function of the class being converted (glm::vec2
in your case).
struct A {};
struct B {
operator A();
};
Or, switched around, as a constructor for class A
.
struct A {
A(const B&);
};
The only other option is to make a non-member converter function.
struct A {};
struct B {};
A convert_to_A(const B&);