Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2004-03-14 09:31:54


On Sun, 14 Mar 2004 12:27:55 -0000, Keith MacDonald wrote
> I'm trying to convert a gregorian::date to a string, as shown in the
> following code:
>
> // Build: cl /EHsc /I \CVS\boost dt.cpp
> #include <iostream>
> #include <boost/date_time/gregorian/gregorian.hpp>
> int main()
> {
> boost::gregorian::date today(2004, boost::gregorian::Mar, 14);
>
> std::cout << today << std::endl;
> return 0;
> }

This definately should work. What happens if you do
  std::cout << to_simple_string(today) << std::endl;
or
  std::wcout << to_simple_wstring(today) << std::endl;

> When I compile it with Visual C++ 7.1, using Boost from CVS head,

Are you positive about this? Changes to support wide streaming went in a
couple weeks back. Seems like maybe you don't have all of that change.

> I
> get the following error:
>
> \CVS\boost\boost\lexical_cast.hpp(150) : error C2679: binary '>>' :
> no operator found which takes a right-hand operand of type
'boost::date_time::date_formatter
> <date_type,format_type,charT>::string_type' (or there is no
> acceptable conversion) with [
> date_type=boost::gregorian::date,
> format_type=boost::date_time::simple_format,
> charT=wchar_t ]
>
> The same thing happens when using to_simple_string and
> to_simple_string_type<char>, rather than operator<<. I actually
> want the result as a basic_string<wchar_t>, but all variations
> produce this same error. What am I doing wrong?

I really don't know. Can you try running the regression tests in your
environment? In particular I'm interested in

libs/date_time/test/gregorian/testgreg_wstream.cpp

Anyway, judging from the regression tests this should be working for you...

Jeff


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