Catch a type error in C++
c++, try-catch, typeerror, types
Solution
Could you give more detail about what is giving you "a result" you may be able to determine what you need from there and more likely in a better way.
If all you really want is to check the type, use `typeid`. More info here
Following Daniel's model of editing posts to actually answer the question after stating something else...
From my other comment:
You have to do this BEFORE you have just the result. Checking for overflow after is not a good idea. Do a check on the numbers before adding to see if they will overflow, or restrict input to be less than half the max value of the type
Problem
How do i check if a result is of the right type(int, float, double, etc.) and then throw and catch an exception in case it's not? Thanks all, Vlad.