ea9bcb2fee
This adds a dependency on libunistring.
20 lines
298 B
C++
20 lines
298 B
C++
#ifndef GENERICS_H_
|
|
#define GENERICS_H_
|
|
|
|
#include <string>
|
|
#include <sstream>
|
|
|
|
namespace sc {
|
|
|
|
template<typename T>
|
|
T from_string(const std::string& val) {
|
|
T result;
|
|
std::istringstream iss {val};
|
|
iss >> result;
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
#endif // GENERICS_H_
|