Convert wide character strings to boost dates
问题 I need to convert several million dates stored as wide strings into boost dates The following code works. However, it generates a horrible compiler warning and does not seem efficient. Is there a better way? #include "boost/date_time/gregorian/gregorian.hpp" using namespace boost::gregorian; #include <string> using namespace std; wstring ws( L"2008/01/01" ); string temp(ws.length(), '\0'); copy(ws.begin(), ws.end(), temp.begin()); date d1( from_simple_string( temp ) ); cout << d1; The better