I have a function which looks like this:
template<class T, class E, class U = T> T function(T input1, E input2) {
// implementation here
}
Instead of the above declaration, I want the default for U to be a macro which takes T for input. More specifically, I want the default for U to be boost::multiprecision::cpp_int if T is boost::multiprecision::cpp_int, and I want the default for U to be an integer with double the precision of T for fixed precision T.
I know the second part can be accomplished with:
U = boost::uint_t<2 * std::numeric_limits<T>::digits>::fast
How do I check for T being a cpp_int (or any other arbitrary precision integer within std and boost), and put everything together in a macro?
Edit:
I found that testing for arbitrary precision can be done through:
std::numeric_limits<T>::is_bounded
I still do not know how to combine these 2 tests into 1 macro.