
after fidling around with template functions i discovered you could write lexical_cast without any template arguments _required_. Also I neat little C-Style cast although no one is probably interested in using that. Anyways the syntax is as followed for both: // lexical cast improved: string str = lexical_cast( 3.1415f ); int i = lexical_cast( "12345" ); // C-style cast fun! string str = (cstyle_cast)3.1415f; int i = (cstyle_cast)"12345"; I would say that anyone already using lexical_cast would'nt have a problem with the improved one. Let me know what you guys think and if we should implement that. -Jason SOURCE CODE: #include <sstream> using namespace std; class cstyle_cast { public: template <typename Source> cstyle_cast( const Source & source ) { ss << source; } template <typename Target> operator Target() { Target target; ss >> target; return target; } private: stringstream ss; }; class lexical_cast { public: template <typename Source> lexical_cast( const Source & source ) { ss << source; } template <typename Target> operator Target() { Target target; ss >> target; return target; } private: stringstream ss; }; int main() { string str1 = (cstyle_cast)3.141592f; string str2 = lexical_cast(3.141592f); }