Making a Universal Vector2 Type in C++ - Part 1: Library User Perspective | File Descriptor Two
The Interoperability Problem
When using multiple libraries in your project, a quite frequent source of annoyance is trying to share their fundamental types, such as a two dimensional vector, quaternion, euler angle, etc. In each library, you can find various names for exactly the same concept.
Consider a hypothetical game development scenario: you could be using Box2D for physics (which has b2Vec2), raylib for graphics (which has Vector2). Despite that two types represent exactly the same thing, they cannot be used interchangeably. This forces you to copy one object into another, every time you wish to pass data and convert between them. Since these conversions are needed quite frequently, constantly operating on copies can become
https://peter0x44.github.io/posts/universal_vector2_pt1/
Making a Universal Vector2 Type in C++ - Part 1: Library User Perspective | File Descriptor Two
The Interoperability Problem
When using multiple libraries in your project, a quite frequent source of annoyance is trying to share their fundamental types, such as a two dimensional vector, quaternion, euler angle, etc. In each library, you can find various names for exactly the same concept.
Consider a hypothetical game development scenario: you could be using Box2D for physics (which has b2Vec2), raylib for graphics (which has Vector2). Despite that two types represent exactly the same thing, they cannot be used interchangeably. This forces you to copy one object into another, every time you wish to pass data and convert between them. Since these conversions are needed quite frequently, constantly operating on copies can become
https://peter0x44.github.io/posts/universal_vector2_pt1/