Boost logo

Boost :

Subject: Re: [boost] [spirit/karma] missing specialization for char types in numeric_utils.hpp
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2009-12-02 09:41:43


> while testing some stuff using the karma generator like this
>
> >>>
> template <typername T> void do_calculations()
> {
> char buf [65]; // this is enough to display any of the numbers
> T val = value_getter();
>
> char * ptr = buf;
> boost::spirit::karma::generate( ptr, boost::spirit::karma::int_,
> val );
> *ptr='\0';
> std::cout << buf << std::endl;
> }
> <<<
> the compiler (MSVC 2005) gave me errors when T was any of the "char"
> family
> about ambiguous overloads for "fabs()".
>
> After adding the lines
> BOOST_SPIRIT_ABSOLUTE_VALUE(signed char, unsigned char);
> BOOST_SPIRIT_ABSOLUTE_VALUE(char, unsigned char);
> and
> BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned char);
> in boost\spirit\home\karma\numeric\detail\numeric_utils.hpp
>
> , the problem went away. (This is with boost 1.41.0)
>
> I am not sure if this is the proper way to fix this or whether we'd
> need to
> regard the possibly different implementations for "char" in various
> compilers.
> If this really fuixes this bug, could anyone please commit the changes
> to
> the next release?

I patched in your fix and will commit after my local tests have cycled.

Thanks!
Regards Hartmut

-------------------
Meet me at BoostCon
http://boostcon.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk