PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
convertToString_impl.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __CONVERTTOSTRING_IMPL_H__
8 #define __CONVERTTOSTRING_IMPL_H__
9 
10 #include "convertToString.h"
11 #include "PString.h"
12 #include "PPath.h"
13 
15 
18 template<typename T>
19 std::string valueToString(const T & val){
20  std::stringstream str;
21  str << val;
22  return str.str();
23 }
24 
26 
29 template<typename T>
30 T stringToValue(const std::string & str){
31  std::stringstream strStream;
32  strStream << str;
33  T val;
34  strStream >> val;
35  return val;
36 }
37 
38 
39 #endif
40 
std::string valueToString(const T &val)
Convert a type into a string.
T stringToValue(const std::string &str)
Convert a string into value.