fork download
  1. #include <iostream>
  2.  
  3. template <typename Type>
  4. struct Vector2
  5. {
  6. Type x, y;
  7. };
  8.  
  9. using Vector2F = Vector2<float>;
  10. using Vector2U = Vector2<unsigned int>;
  11.  
  12. template <typename LhsType, typename RhsType>
  13. bool operator == (LhsType lhs, RhsType rhs)
  14. {
  15. return lhs.x == rhs.x && lhs.y == rhs.y;
  16. }
  17.  
  18. int main()
  19. {
  20. Vector2F myVecF { 1.0f, 2.0f };
  21. Vector2U myVecU { 1, 2 };
  22.  
  23. std::cout << (myVecF == myVecU) << std::endl;
  24.  
  25. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1