16
General / Re: SFML book, chapter 2 issue
« on: February 22, 2016, 03:37:40 pm »
I once read in a good book about C++ (More Effective C++ by Scott Meyers), that it is tempting to overload binary operators like '+', '-' etc. for non-arithmetic types, but most often it isn't a good idea because of its overly non-verbose syntax and your actual operation get's lost behind the simple and implicit + syntax. So because of that, I will never ever overload operator '+' and instead write a generic converter function with an explicit name to state what I am doing with the supplied type.
(One can still argue if an enum class of unsigned int is a non-arithmetic type, I do, with the exception of std::string)
(One can still argue if an enum class of unsigned int is a non-arithmetic type, I do, with the exception of std::string)