I am trying to parse a date which contains a single digit for each of the month and the day. The following parses correctly:
std::istringstream ss("2015/05/01");
std::tm tmb = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
ss >> std::get_time(&tmb, "%Y/%m/%d");
But when I try to parse
std::istringstream ss("2015/5/1");
I get a failed state in the stream and the time has not been read into the struct properly. Is there a clean (and efficient) way I can parse this?
EDIT: I am developing on Ubuntu 12.04 and the compiler g++ 5.4.1.