Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2002-03-26 08:41:02

I have a little class digit_traits that might be interesting to boost.
It's just replacement for nonportable char (or wchar_t) to digit conversion:

  char seven = '7';
  int digit = seven - '0';
  assert(digit == 7);

With digit_traits this conversion is:

  char seven = '7';
  int digit = digit_traits<char>::digit2int(seven);
  assert(digit == 7);

For charsets with non-continuous digit characters range it should work just fine
(although I don't know about such charsets and didn't find the requirement in
Standard for digit characters to be continuous) .

Links to source code are:


Alexander Nasonov

Boost list run by bdawes at, gregod at, cpdaniel at, john at