
18 Jul
2012
18 Jul
'12
11:02 a.m.
On 07/18/2012 12:54 PM, Paul A. Bristow wrote:
Suggestions welcome :-)
Hi, Either: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_staticassert.html BOOST_STATIC_ASSERT(boost::is_floating_point<FPT>::value); Or: http://www.boost.org/doc/libs/1_47_0/libs/utility/enable_if.html template <typename FPT> std::string f(FPT v, typename boost::enable_if_c<boost::is_floating_point<FPT>::value>::type* = 0) But you might as well consider having: template <typename FPT> std::string f_impl(FPT v) { } std::string f(float v) { return f_impl(v); } std::string f(double v) { return f_impl(v); } Best, -- Maxime