Advertisement
Rajveer

GDB C++11 failure

Nov 27th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. template <class T>
  2. class Vector3t
  3. {
  4. public:
  5.     T x;
  6.     T y;
  7.     T z;
  8.  
  9.     Vector3t(T _x = static_cast<T>(0.0), T _y = static_cast<T>(0.0), T _z = static_cast<T>(0.0));
  10.     template <class U> auto operator+(const Vector3t<U> &a) const->Vector3t<decltype(T()*U())>;
  11. };
  12.  
  13. template <class T>
  14. inline Vector3t<T>::Vector3t(T _x, T _y, T _z) : x(_x), y(_y), z(_z)
  15. {
  16. }
  17.  
  18. template <class T> template <class U>
  19. inline auto Vector3t<T>::operator+(const Vector3t<U> &a) const -> Vector3t<decltype(T()*U())>
  20. {
  21.     return Vector3t<decltype(T()*U())>(x + a.x, y + a.y, z + a.z);
  22. }
  23.  
  24.  
  25.  
  26. void android_main(struct android_app* appState)
  27. {
  28.     Vector3t<float> vec1;
  29.     Vector3t<float> vec2;
  30.  
  31.     auto vec3 = vec2 + vec1;
  32.  
  33.     int x = 0;
  34.  
  35.     while (1)
  36.     {
  37.         x++;
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement