but as Paul pointed out, it can also cause problems
I wasn't picking on your efforts.
Even disallowing Strings and strings, does it make sense to use different types for the from range (float fromMin, long fromMax), for instance? Does it make sense to use different types for the to range (long long toMin, byte toMax)?C allows you to shoot yourself in the foot. C++'s templates allow you to blow your whole leg off.This is a situation, I think, where a template is NOT a good idea.
- Check if binary search is faster- Implement a simple cache that holds the last used value (some projects would benefit)