mirror of https://github.com/CGAL/cgal
24 lines
407 B
C++
24 lines
407 B
C++
|
|
#include <string>
|
|
#include <sstream>
|
|
|
|
template <class T>
|
|
bool from_string(T &t,
|
|
const std::string &s,
|
|
std::ios_base & (*f)(std::ios_base&))
|
|
{
|
|
std::istringstream iss(s);
|
|
return !(iss>>f>>t).fail();
|
|
}
|
|
|
|
|
|
template <class T>
|
|
std::string to_string(T t, std::ios_base & (*f)(std::ios_base&)=std::dec)
|
|
{
|
|
std::ostringstream oss;
|
|
oss << f << t;
|
|
return oss.str();
|
|
}
|
|
|
|
|