static assertion in date_serialization_demo
Hi, I've tried to build this simple code using vc 7.1 using namespace boost::gregorian; date d(2004, Apr, 5); std::ofstream ofs("date_demo.txt"); boost::archive::text_oarchive oa(ofs); oa << d; but it fails due to a static assertion. The code is taken from the very first lines of boost_serialization_demo.cpp. It seems to compile with boost 1.32, but seems to fail with current boost. Since this demo is not be included in the jamfile (or I was not able to find it), I built it is using visual studio IDE. The compiler command-line options were: /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /MLd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64 /ZI /TP I also tried to turn on/off the RTTI, but the result did not change. The error I get is d:\PROJECTS\boost\boost\archive\detail\oserializer.hpp(557) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>' Am I missing something? Thanks, Paolo
On Mon, 23 May 2005 09:47:07 +0200, Paolo Coletta wrote
Hi,
I've tried to build this simple code using vc 7.1
using namespace boost::gregorian;
date d(2004, Apr, 5); std::ofstream ofs("date_demo.txt"); boost::archive::text_oarchive oa(ofs); oa << d;
One tip --> in 1.33 you will need to make the date const or oa << d will fail. Serialization is now enforcing this previously documented part of the interface... So date d(2004, Apr, 5); needs to be const date d(2004, Apr, 5);
but it fails due to a static assertion. The code is taken from the very first lines of boost_serialization_demo.cpp. It seems to compile with boost 1.32, but seems to fail with current boost.
Since this demo is not be included in the jamfile (or I was not able to find it), I built it is using visual studio IDE.
It's missing :-(
The compiler command-line options were: /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /MLd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64 /ZI /TP
I also tried to turn on/off the RTTI, but the result did not change.
The error I get is d:\PROJECTS\boost\boost\archive\detail\oserializer.hpp(557) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
Am I missing something?
Doesn't seem like it. I'm getting the same problem on Linux with gcc 3.x even with the modification suggested above. I'll look into it and let you know. BTW, the regression tests are passing, so I'm unsure what's happened here... Jeff
One tip --> in 1.33 you will need to make the date const or oa << d will fail. Serialization is now enforcing this previously documented part of the interface...
So
date d(2004, Apr, 5);
needs to be
const date d(2004, Apr, 5);
Is that for real? I admit I have not used this library so maybe I should be ignored, but what is the reasoning for only being able to serialize consts? At the moment it does not sound useful. - R -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Jeff Garland Sent: 23 May 2005 16:02 To: boost-users@lists.boost.org Subject: Re: [Boost-users] static assertion in date_serialization_demo On Mon, 23 May 2005 09:47:07 +0200, Paolo Coletta wrote
Hi,
I've tried to build this simple code using vc 7.1
using namespace boost::gregorian;
date d(2004, Apr, 5); std::ofstream ofs("date_demo.txt"); boost::archive::text_oarchive oa(ofs); oa << d;
One tip --> in 1.33 you will need to make the date const or oa << d will fail. Serialization is now enforcing this previously documented part of the interface... So date d(2004, Apr, 5); needs to be const date d(2004, Apr, 5);
but it fails due to a static assertion. The code is taken from the very first lines of boost_serialization_demo.cpp. It seems to compile with boost 1.32, but seems to fail with current boost.
Since this demo is not be included in the jamfile (or I was not able to find it), I built it is using visual studio IDE.
It's missing :-(
The compiler command-line options were: /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /MLd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64 /ZI /TP
I also tried to turn on/off the RTTI, but the result did not change.
The error I get is d:\PROJECTS\boost\boost\archive\detail\oserializer.hpp(557) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
Am I missing something?
Doesn't seem like it. I'm getting the same problem on Linux with gcc 3.x even with the modification suggested above. I'll look into it and let you know. BTW, the regression tests are passing, so I'm unsure what's happened here... Jeff _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Mon, 23 May 2005 16:25:46 +0100, Richard Howells wrote
One tip --> in 1.33 you will need to make the date const or oa << d will fail. Serialization is now enforcing this previously documented part of the interface...
So
date d(2004, Apr, 5);
needs to be
const date d(2004, Apr, 5);
Is that for real? I admit I have not used this library so maybe I should be ignored, but what is the reasoning for only being able to serialize consts? At the moment it does not sound useful.
There's been a discussion on the dev-list about this change -- even though the interface was documented in 1.32 it wasn't enforced. Frankly, I don't think it has hit everyone (Robert included) how intrusive this change is. There's a couple of us (me included) that think this change is a really bad idea, but we haven't convinced Robert. Anyway, Robert's view is that this will help prevent downstream errors related to object tracking. Jeff
Richard Howells wrote:
One tip --> in 1.33 you will need to make the date const or oa << d will fail. Serialization is now enforcing this previously documented part of the interface...
So
date d(2004, Apr, 5);
needs to be
const date d(2004, Apr, 5);
Is that for real? I admit I have not used this library so maybe I should be ignored, but what is the reasoning for only being able to serialize consts? At the moment it does not sound useful.
- R
It doesn't mean only const data can serialized. It just means that ways of using the library can lead to problems and this helps trap them. You'll have to read the thread. I'll try to add a more extensive explanation to the documentation. Robert Ramey
participants (4)
-
Jeff Garland
-
Paolo Coletta
-
Richard Howells
-
Robert Ramey