[spirit/karma] missing specialization for char types in numeric_utils.hpp

Hi, 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? Cheers, Robert

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
participants (2)
-
Hartmut Kaiser
-
Robert.Macketanz@rohde-schwarz.com