Boost logo

Boost Users :

Subject: [Boost-users] [Date Time] MSVC CRT assertion stops execution in debug mode
From: Fumito Hamamura (latestbloomer_at_[hidden])
Date: 2012-11-03 11:08:05


Hi, I'm testing the code below using boost 1.50.0 and Visual C++ 2008.

What I expected was, the ptime t doesn't throw an exception even though it
doesn't get a valid date time string passed by the wstringstream ss.

When it is compiled in Release mode, it works as expected, i.e. the program
runs without an error, but when compiled in Debug mode, the program stops
because debug assertion fails in _chvalidator in isctype.c, which is called
by std::isspace.

Is there a known workaround for this?

Thanks,
Fumito

-----
#include <iostream>
#include <string>
#include "boost/date_time/posix_time/posix_time.hpp"

int wmain(int argc, wchar_t* argv[])
{
     boost::posix_time::wtime_input_facet*
       dt_facet(new boost::posix_time::wtime_input_facet(L"%Y/%m/%d
%H:%M"));

     std::wstringstream ss;
     boost::posix_time::ptime t;

    ss.imbue(std::locale(ss.getloc(), dt_facet));

    ss << L"あいうえお";
    ss >> t;

    return 0;
}
-----



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