alternative line

can someone tell me what can i use altenatively to prevent from using lines like this " std::to_string(total_amount) "

instead of using std:: what should i put?
> instead of using std:: what should i put?

my::to_string(), may be?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <sstream>
#include <string>

namespace my
{
    template< typename T > std::string to_string( const T& v )
    {
        std::ostringstream stm ;
        if( stm << v ) return stm.str() ;
        else return "parse error" ;
    }
}

#include <iostream>

int main()
{
   std::string i = my::to_string( 0x1234 ) ;
   std::string d = my::to_string( -1.2345e+3 ) ;
   std::string l = my::to_string( "not a number" ) ;
   std::cout << i << ' ' << d << ' ' << l << '\n' ;
}
Maybe you searching info about this:
http://www.cplusplus.com/doc/tutorial/namespaces/
look at "using" section
Topic archived. No new replies allowed.