numericfield: cleanup for floating point types
Rework so floating point values are supported to the same degree as integer values. Closes #214
This commit is contained in:
parent
d0a56f4235
commit
4d34c582d0
|
|
@ -30,8 +30,7 @@ namespace AMQP {
|
||||||
template<
|
template<
|
||||||
typename T,
|
typename T,
|
||||||
char F,
|
char F,
|
||||||
typename = typename std::enable_if<std::is_arithmetic<T>::value, T>,
|
typename = typename std::enable_if<std::is_arithmetic<T>::value, T>
|
||||||
typename = typename std::enable_if<std::is_integral<T>::value, T>
|
|
||||||
>
|
>
|
||||||
class NumericField : public Field
|
class NumericField : public Field
|
||||||
{
|
{
|
||||||
|
|
@ -126,6 +125,8 @@ public:
|
||||||
operator int16_t () const override { return (int16_t)_value; }
|
operator int16_t () const override { return (int16_t)_value; }
|
||||||
operator int32_t () const override { return (int32_t)_value; }
|
operator int32_t () const override { return (int32_t)_value; }
|
||||||
operator int64_t () const override { return (int64_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
|
* Get the value
|
||||||
|
|
@ -144,7 +145,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool isInteger() const override
|
bool isInteger() const override
|
||||||
{
|
{
|
||||||
return true;
|
return std::is_integral<T>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue