#include <iostream>
#include <string>
#include <sstream>

template<typename T>
struct Test {
	T value;
	Test(std::string);
};

template<>
inline Test<std::string>::Test(std::string str) {
	value = str;
}

template<typename T>
inline Test<T>::Test(std::string str) {
	std::stringstream ss;
	ss.str(str);
	ss >> value;
}

int main() {
	Test<int> t1{"42"};
	Test<double> t2{"3.14159"};
	Test<std::string> t3{"Hello world"};

	std::cout
		<< t1.value << std::endl
		<< t2.value << std::endl
		<< t3.value << std::endl;

	return 0;
}
