I'm curious, is it possible to write an all-encompassing implementation like
template <typename T> 
bool overflows(T a, T b)
{
  // ... Returns true or false depending on whether a+b overflows
}
????
If not, can someone at least show me how to write an implementation of
   bool overflows (unsigned int a, unsigned int b)
   {
       // ... returns true or false depending on whether a+b > ~0
   }
???
Since I don't have a Computer Science degree, I don't have any formal education about how programs are supposed to handle overflow, although I understand the concept of overflow (If our range of numbers is, say, 0,1,...,127, then the + operation doesn't "work" on 64+64, 65+63, 66,62, etc.)
 
    