```fooToString``` functions are IMO not convenient and no good style. The usecase here is easily solved e.g. by using ```boost::format``` (see below). This way you would not need this function at all.

If you want standalone functions to do this kind of conversion, use overloading and let the compiler choose the appropriate one. E.g.
```
    inline std::string numstring( char n,               int w = 0 ) { return form( "%*hhd",  w, n ); }
    inline std::string numstring( unsigned char n,      int w = 0 ) { return form( "%*hhu",  w, n ); }
    inline std::string numstring( short n,              int w = 0 ) { return form( "%*hd",   w, n ); }
    inline std::string numstring( unsigned short n,     int w = 0 ) { return form( "%*hu",   w, n ); }
    inline std::string numstring( int n,                int w = 0 ) { return form( "%*d",    w, n ); }
    inline std::string numstring( unsigned n,           int w = 0 ) { return form( "%*u",    w, n ); }
    inline std::string numstring( long n,               int w = 0 ) { return form( "%*ld",   w, n ); }
    inline std::string numstring( unsigned long n,      int w = 0 ) { return form( "%*lu",   w, n ); }
    inline std::string numstring( long long n,          int w = 0 ) { return form( "%*lld",  w, n ); }
    inline std::string numstring( unsigned long long n, int w = 0 ) { return form( "%*llu",  w, n ); }
```
You could also generalize this further, if it is common to at most of your classes to provide an e.g. ```asString()``` method:
```
    /**
     * Global asString() that works with std::string too
     */
    inline std::string asString( const std::string &t )
    { return t; }

    inline std::string asString( const char * t )
    { return t; }

    inline std::string asString( char * t )
    { return t; }

    template<class _T>
        inline std::string asString( const _T &t )
        { return t.asString(); }

    template<class _T>
        inline std::string asString( const intrusive_ptr<_T> &p )
        { return p->asString(); }

    template<class _T>
        inline std::string asString( const weak_ptr<_T> &p )
        { return p->asString(); }

    template<>
        inline std::string asString( const bool &t )
        { return t ? "TRUE" : "FALSE"; }
```
The compiler will tell you if you use ```asString``` on a type that has no conversion. If it's missing, provide onr
```
    template<> inline std::string asString( const char & t )                    { return numstring( t ); }
    template<> inline std::string asString( const unsigned char & t )           { return numstring( t ); }
    template<> inline std::string asString( const short & t )                   { return numstring( t ); }
    template<> inline std::string asString( const unsigned short & t )          { return numstring( t ); }
    template<> inline std::string asString( const int & t )                     { return numstring( t ); }
    template<> inline std::string asString( const unsigned & t )                { return numstring( t ); }
    template<> inline std::string asString( const long & t )                    { return numstring( t ); }
    template<> inline std::string asString( const unsigned long & t )           { return numstring( t ); }
    template<> inline std::string asString( const long long & t )               { return numstring( t ); }
    template<> inline std::string asString( const unsigned long long & t )      { return numstring( t ); }
```