Boost logo

Boost Users :

Subject: [Boost-users] date-time library and checked iterators
From: gast128 (gast128_at_[hidden])
Date: 2008-09-16 05:53:10


Dear all,

last week we switched to vstudio 2008. It has checked iterator support and it
already catched two incorrect (but probably also harmless) uses of iterators.

Maybe in the date time library there is also such a case.

The stream operator on ptime eventually calls date_time::date_facet::do_put_tm
() function which probably uses an incorrect way of dereferencing string
iterators when empty:

// use time_put facet to create final string
return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next, a_ios,
fill_char, &tm_value, &*a_format.begin(), &*a_format.begin()+a_format.size());

When a_format is empty the begin iterator may not be dereferenced? I do know
that the actual code is harmless, but now we get the M$ checked iterator error
message, and turning it globally off would be pity, since it cna be an extra
potential debugging tool.

Wkr,
me


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net