#include template bool from_string (t & t, const st: string & s, std :: os_base & (* f) (std :: os_base &) {std :: istringstream ISS (s); Return! (ISS >> F >> T) .fail ();
Template std :: string to_string (const t & TValue, std :: os_base & (* f) (std :: ostrstream OS; oss << f << TValue << '/ 0 '; Return oss.str ();}; # include #include
void main ()
{
INT i; float f; // from_string () The third parameter should be one // one of std :: hex, std :: dec, std :: 动 (from_string (I, STD) :: string ("ff"), std :: hex) {std :: cout << i << std :: end1;} else {std :: cout << "from_string failed << std :: end1 } F (from_string (f, std :: string ("123.456"), std :: dec)) {std :: cout << f << std :: end1;} else {std :: cout << "from_string failed" << std :: end1;
}