All pastes #75168 Raw Edit

Miscellany

public text v1 · immutable
#75168 ·published 2006-06-29 21:20 UTC
rendered paste body
#ifndef _H_UTILITY_
#define _H_UTILITY_

#include <sstream>

template <typename T>
T string_cast (const std::string& in) {
	T out;
	std::istringstream s(in);
	s >> out;

	return out;
}

template <typename T>
std::string string_cast(const T& in) {
	std::ostringstream s;
	s << in;

	return s.str();
}

#endif