From 4d34c582d07dad3965cf6b6b83c9ca10f55f3571 Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Fri, 20 Apr 2018 20:20:47 -0500 Subject: [PATCH] numericfield: cleanup for floating point types Rework so floating point values are supported to the same degree as integer values. Closes #214 --- include/amqpcpp/numericfield.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/amqpcpp/numericfield.h b/include/amqpcpp/numericfield.h index a54c3f8..2239ada 100644 --- a/include/amqpcpp/numericfield.h +++ b/include/amqpcpp/numericfield.h @@ -30,8 +30,7 @@ namespace AMQP { template< typename T, char F, - typename = typename std::enable_if::value, T>, - typename = typename std::enable_if::value, T> + typename = typename std::enable_if::value, T> > class NumericField : public Field { @@ -126,6 +125,8 @@ public: operator int16_t () const override { return (int16_t)_value; } operator int32_t () const override { return (int32_t)_value; } operator int64_t () const override { return (int64_t)_value; } + operator float () const override { return (float)_value; } + operator double () const override { return (double)_value; } /** * Get the value @@ -144,7 +145,7 @@ public: */ bool isInteger() const override { - return true; + return std::is_integral::value; } /**