
18 Jul
2012
18 Jul
'12
8:40 a.m.
template <typename FPT> std::string f(FPT v) { ... }
At present I have added a run-time check, but doesn't prevent compilation (and instantiation).
if (boost::is_floating_point<FPT>::value; == false) { assert fail or something and/or return " "Type Not floating point!"; }
I don't see how enable_if can help either.
template <typename FPT> typename enable_if<is_floating_Point<FPT>, std::string>::type f(FPT v) { ... } If FTP is not a built in floating point type, then no overload for f() will be found and you'll get a compiler error. HTH, John.