Skip to content
Snippets Groups Projects
Commit 6e6375ee authored by Jan Trávníček's avatar Jan Trávníček
Browse files

normalize api of all string to integral functions

parent dab98be6
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,31 @@ int from_string ( const string & value ) {
return stoi__private ( value.c_str() );
}
 
template < >
long from_string ( const string & value ) {
return stol__private ( value.c_str() );
}
template < >
long long from_string ( const string & value ) {
return stoll__private ( value.c_str() );
}
template < >
unsigned from_string ( const string & value ) {
return stoul__private ( value.c_str() );
}
 
template < >
unsigned long from_string ( const string & value ) {
return stoul__private ( value.c_str() );
}
template < >
unsigned long long from_string ( const string & value ) {
return stoull__private ( value.c_str() );
}
string cstringToString ( char * param ) {
string res ( param );
 
......
/*
* string.cpp
* string.hpp
*
* Created on: Apr 1, 2013
* Author: Jan Travnicek
......
......@@ -3,6 +3,7 @@
 
#define stoi stoi__private
#define stol stol__private
#define stoll stoll__private
#define stoul stoul__private
#define stoull stoull__private
#define to_string to_string__private
......@@ -11,6 +12,7 @@
 
#undef stoi
#undef stol
#undef stoll
#undef stoul
#undef stoull
#undef to_string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment