Index: boost/spirit/home/support/utree/detail/utree_detail2.hpp =================================================================== --- boost/spirit/home/support/utree/detail/utree_detail2.hpp (revision 84392) +++ boost/spirit/home/support/utree/detail/utree_detail2.hpp (working copy) @@ -469,6 +469,9 @@ case type::int_type: return f(x.i); + case type::float_type: + return f(x.f); + case type::double_type: return f(x.d); Index: boost/spirit/home/support/utree/utree.hpp =================================================================== --- boost/spirit/home/support/utree/utree.hpp (revision 84392) +++ boost/spirit/home/support/utree/utree.hpp (working copy) @@ -80,6 +80,7 @@ // numeric atoms bool_type, // An utree holding a boolean value int_type, // An utree holding a integer (int) value + float_type, // An utree holding a floating point (float) value double_type, // An utree holding a floating point (double) value // text atoms (utf8) @@ -108,6 +109,7 @@ case utree_type::function_type: { out << "function"; break; } case utree_type::bool_type: { out << "bool"; break; } case utree_type::int_type: { out << "int"; break; } + case utree_type::float_type: { out << "float"; break; } case utree_type::double_type: { out << "double"; break; } case utree_type::string_type: { out << "string"; break; } case utree_type::string_range_type: { out << "string_range"; break; } @@ -398,6 +400,11 @@ reference operator=(unsigned int); reference operator=(int); + // This initializes a `float_type` node, which can hold arbitrary + // floating point (float) values. + utree(float); + reference operator=(float); + // This initializes a `double_type` node, which can hold arbitrary // floating point (double) values. utree(double); @@ -598,6 +605,7 @@ detail::void_ptr v; bool b; int i; + float f; double d; utree* p; function_base* pf; Index: boost/spirit/home/support/utree/utree_traits.hpp =================================================================== --- boost/spirit/home/support/utree/utree_traits.hpp (revision 84392) +++ boost/spirit/home/support/utree/utree_traits.hpp (working copy) @@ -901,6 +901,18 @@ }; template <> + struct compute_compatible_component_variant + : mpl::true_ + { + typedef float compatible_type; + + static bool is_compatible(int d) + { + return d == utree_type::float_type; + } + }; + + template <> struct compute_compatible_component_variant : mpl::true_ { @@ -1122,6 +1134,18 @@ }; template <> + struct extract_from_container + { + typedef float type; + + template + static type call(utree const& t, Context&) + { + return detail::get_or_deref(t); + } + }; + + template <> struct extract_from_container { typedef double type; @@ -1219,6 +1243,17 @@ }; template <> + struct transform_attribute + { + typedef float type; + + static type pre(utree const& t) + { + return detail::get_or_deref(t); + } + }; + + template <> struct transform_attribute { typedef double type;