Перегрузка оператора друга в шаблоне C ++
Что не так с моим кодом?
template<int E, int F>
class Float
{
friend Float<E, F> operator+ (const Float<E, F> &lhs, const Float<E, F> &rhs);
};
G ++ просто держит предупреждение:
float.h:7: warning: friend declaration ‘Float<E, F> operator+(const Float<E, F>&, const Float<E, F>&)’ declares a non-template function
float.h:7: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning
Я пыталсяadd <> after the function name here
как упоминалось в предупреждении, но g ++ выдает ошибку.
Я скомпилировал код с помощью clang ++, все было нормально, без предупреждения.