Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61213 - trunk/boost/spirit/home/karma/numeric/detail
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-11 18:09:28


Author: hkaiser
Date: 2010-04-11 18:09:28 EDT (Sun, 11 Apr 2010)
New Revision: 61213
URL: http://svn.boost.org/trac/boost/changeset/61213

Log:
Spirit: allow to output pointers using uint generators
Text files modified:
   trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp | 14 +++++++++++++-
   1 files changed, 13 insertions(+), 1 deletions(-)

Modified: trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp (original)
+++ trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp 2010-04-11 18:09:28 EDT (Sun, 11 Apr 2010)
@@ -132,6 +132,17 @@
             }
         };
 
+ // specialization for pointers
+ template <typename T>
+ struct absolute_value_helper<T*>
+ {
+ typedef std::size_t result_type;
+ static std::size_t call (T* p)
+ {
+ return std::size_t(p);
+ }
+ };
+
         template <typename T>
         typename absolute_value_helper<T>::result_type
         absolute_value(T n)
@@ -565,7 +576,8 @@
         static bool
         call(OutputIterator& sink, T const& n)
         {
- typename detail::absolute_value_helper<T>::result_type un = n;
+ typedef typename detail::absolute_value_helper<T>::result_type type;
+ type un = type(n);
             return base_type::call(sink, un, un, 0);
         }
     };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk