I'm trying to write code that will compile for POJ. POJ doesn't use C++11 so I can't use really basic STL functions like std::to_string
, std::begin
, or std::end
. I looked around and found another StackOverflow question inquiring about std::to_string
. To get std::to_string
code to compile with a bare g++ myfile.cpp
command, a user suggested this patch, which works nicely:
namespace patch
{
template < typename T > std::string to_string( const T& n )
{
std::ostringstream stm ;
stm << n ;
return stm.str() ;
}
}
I want to do the same thing for std::begin
, std::end
, and std::stoi
, but I'm not sure how to do it. I'm quite unfamiliar with the STL. I just want my working C++11 code to compile with either MS-VC++6.0 or G++ without any flags, etc. How can I do this?