error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'Oper')

Task is to load complex number from a file. When code was written without classes, using stuctures and specified functions only it didn’t show that error. Functions (>> overlading) were completely the same. Class #ifndef WYRAZENIE_ZESPOLONE_HH #define WYRAZENIE_ZESPOLONE_HH #include "liczbaZespolona.hh" enum Oper {op_plus, op_minus, op_razy, op_dziel}; class WyrazenieZespolone { private: LiczbaZespolona lz1; LiczbaZespolona lz2; Oper… Read More error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'Oper')

"binary 'operator+' has too many parameters

Trying to implement operator overloading using the following code: class Number { T value; public: Number(T v); Number(); Number<T> operator+ (Number<T>&, const Number<T> &); T getValue() { return value; }; }; template <typename T> Number<T>::Number(T val):value(val) { } template <typename T> Number<T> Number<T>::operator+ (Number<T>& lhs, const Number<T> & rhs) { return lhs.value + rhs.value; }… Read More "binary 'operator+' has too many parameters

Can I somehow elegantly forbid using unsingned variables in my template function?

Consider this piece of code: template <typename T> T abs(const T& n) { if (!std::is_signed<T>::value) throw logic_error; if (n < 0) return -n; return n; } What do I want to do: I want to completely forbid the usage of my function with unsigned variables since it doesn’t make sense and probably user is don’t… Read More Can I somehow elegantly forbid using unsingned variables in my template function?