Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T>
- class Vector2
- {
- ...
- template <typename> // объявляем дружественную ф-цию шаблонной
- friend Vector2<T> operator +(Vector2<T> const& l_v, Vector2<T> const& r_v);
- ...
- }
- template <typename T>
- Vector2<T> operator +(Vector2<T> const& l_v, Vector2<T> const& r_v)
- { ... }
- template <typename> Vector2<T> operator+(Vector2 < T >
- const & l_v,
- Vector2<T> const& r_v
- )
- {
- return
- Vector2<T>();
- }
- // да-да, именно в таком виде, со всеми отступами
- template <typename>
- friend Vector2<T> operator +(Vector2<T> const& l_v, Vector2<T> const& r_v);
- template <typename U>
- friend Vector2<T> operator +(Vector2<T> const& l_v, Vector2<T> const& r_v);
- template <typename U>
- friend Vector2<int> operator +(Vector2<int> const& l_v, Vector2<int> const& r_v);
- template <typename T>
- Vector2<T> operator +(Vector2<T> const& l_v, Vector2<T> const& r_v)
- { ... }
Add Comment
Please, Sign In to add comment