![Boost Software License][license-badge]
This repository holds code demonstration related safe numerics
Boost Software License. It is free for open source and close source project.
usage:
long l = INT_MAX + (long)1;
int i = numeric_cast<>(1); // this will throw overflow exception!
auto b = is_convertable<int>(l); // gives false, let you test overflow without using C++ exception
is_numeric<T>::value // can be used as in template, inside std::enable_if<>
proposal: Reuse keyword explicit
to prevent implicit conversion of function parameter
It has already introduced in C++20, here there is a demo to use them has_member.h, and also collected solution from Stackoverflow, to implement in C++03, C++11.