Advertisement
Gistrec

Template point

Jun 4th, 2019
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #pragma once
  2.  
  3. template <class Type = double>
  4. class TPoint : private std::pair<Type, Type> {
  5. public:
  6.     Type x = &first;
  7.     Type y = &second;
  8.  
  9.     TPoint(Type x, Type y) : first(x), second(y) { };
  10.     Type& x() { return first;  };
  11.     Type& y() { return second; };
  12. };
  13.  
  14. typedef TPoint<> Point;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement