nttlTraits Method - DecimalDigits

Description
For a given value, x, return the number of digits in the decimal (base 10) representation of x.

The default implementation of this method is not very efficient at all.  It uses a ostrstream object to convert x to a decimal representation in a string.  Then it counts the number of characters in the string.  This method should really be specialized for T, if at all possible.

Signature
template<class T> size_t nttlTraits::DecimalDigits( const T& x )
Parameters
Name Type Description
x T Some number.
Returns
( size_t )  The number of digits in the decimal (base 10) representation of x.
Example
#include <nttl/nttlTraits.h>
...
nttlTraits<int> tr;
...
int x = 123;
size_t s = tr.DecimalDigits( x );