|
Boost Users : |
Subject: Re: [Boost-users] How to force a compile failure if a template parameter isn't floating-point
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2012-07-19 05:06:26
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf
Of
> Eric Niebler
> Sent: Wednesday, July 18, 2012 5:44 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] How to force a compile failure if a template parameter isn't
floating-point
>
> On 7/18/2012 4:02 AM, Maxime van Noppen wrote:
> > 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); }
>
> Don't forget long double. But +1 to the simple suggestion.
Ok - I'm all for KISS - BUT the imposing spectre of multiprecision looms ;-)
But thanks for the helpful suggestions.
Paul
--- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net