From 1b44d70c92e692b9f6a27d46c6d612a819d05e48 Mon Sep 17 00:00:00 2001 From: "Anatoliy V. Tomilov" Date: Tue, 3 Nov 2015 21:31:08 +0500 Subject: [PATCH 1/3] Facilitate the requirements to custom floating-point type The change allow user to provide only explicit conversion constructor for construction from integral types. --- include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp b/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp index fb30f02306..bd5912d7e3 100644 --- a/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp +++ b/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp @@ -142,7 +142,7 @@ namespace boost { namespace spirit { namespace x3 bool neg = p.parse_sign(first, last); // Now attempt to parse an integer - T n = 0; + T n(0); bool got_a_number = p.parse_n(first, last, n); // If we did not get a number it might be a NaN, Inf or a leading From 2271e499d81a222642fe9f6e0086f976ea744ced Mon Sep 17 00:00:00 2001 From: "Anatoliy V. Tomilov" Date: Tue, 3 Nov 2015 21:40:27 +0500 Subject: [PATCH 2/3] Facilitate the requirements to custom floating-point type (comparison) The change allows the user to make custom floating-point type equality comparable only. operator == (double) is not required. --- include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp b/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp index bd5912d7e3..e08795bd3d 100644 --- a/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp +++ b/include/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp @@ -112,7 +112,7 @@ namespace boost { namespace spirit { namespace x3 { namespace extension inline bool is_equal_to_one(T const& value) { - return value == 1.0; + return value == T(1); } inline bool From ae526b3efd039c095e7d7387097cbe43c9fdb890 Mon Sep 17 00:00:00 2001 From: "Anatoliy V. Tomilov" Date: Wed, 30 Dec 2015 20:40:24 +0500 Subject: [PATCH 3/3] Update extract_int.hpp --- .../boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp b/include/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp index 73770c87d0..eeee815d8b 100644 --- a/include/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp +++ b/include/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp @@ -416,7 +416,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail { if (count == 0) // must have at least one digit return false; - attr = 0; + attr = Attribute(0); first = it; return true; }