8 Aug
2013
8 Aug
'13
7:47 a.m.
On 8.8.2013 10:13, Matthijs Möhlmann wrote:
Hello all,
Following piece of program gives a std::out_of_range exception:
datetime = boost::posix_time::time_from_string("2012-5-29");
Hi, time_from_string() expects the string contain both date *and* time. So you're simply feeding it with a bad data. I must say that the source for this exception (basic_string::at) is a bit misleading. By looking at code it is probably thrown from str_from_delimited_time_duration() as it doesn't check if its fed with an empty basic_string (as quite likely happens in this case) and always calls at(0). Maybe somebody (you?) could write a patch that does a little bit more checking or add a note to documentation about this behavior. -- Pekka