Boost logo

Boost Users :

From: Chris Coleman (cqc_at_[hidden])
Date: 2005-07-20 11:50:50


Robert Ramey wrote:

>What is zz_memory ? is it by any chance typedef for something else. Since
>it is a const but still being rejected, it would seem to marked
>"track_never". If not explicity so marked, it might be a typedef for some
>primitive like ?
>
previously:

>Why didn't your just change the above to?:
>
>const gps_position* p_g = new gps_position(35, 59, 24.567f);
>oa << p_g; // causes the error's below
>
>
Ok,

Going back to the gps_position example from the manual,
http://www.boost.org/libs/serialization/doc/tutorial.html#simplecase

If I change nothing other than what is below, then:

const gps_position* g_ptr = new gps_position(35, 59, 24.567f);
oa << g_ptr;

gives us:

cqc$ g++ -o test.o -c test.cpp
/usr/local/include/boost/archive/detail/oserializer.hpp: In function
'void boost::archive::save(Archive&, T&) [with Archive =
boost::archive::text_oarchive, T = const gps_position*]':
/usr/local/include/boost/archive/basic_text_oarchive.hpp:78:
instantiated from 'void
boost::archive::basic_text_oarchive<Archive>::save_override(T&, int)
[with T = const gps_position*, Archive = boost::archive::text_oarchive]'
/usr/local/include/boost/archive/detail/interface_oarchive.hpp:85:
instantiated from 'Archive&
boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
[with T = const gps_position*, Archive = boost::archive::text_oarchive]'
test.cpp:43: instantiated from here
/usr/local/include/boost/archive/detail/oserializer.hpp:560: error:
invalid application of 'sizeof' to incomplete type
'boost::STATIC_ASSERTION_FAILURE<false>'

Also:

gps_position* g_ptr = new gps_position(35, 59, 24.567f);
oa << g_ptr;

and:

gps_position* g_ptr = new gps_position(35, 59, 24.567f);
oa << *g_ptr;

Both result in a STATIC_ASSERT failure, with T = gps_position*, and
gps_position respectively.

The only case I can get to compile is:

const gps_position* g_ptr = new gps_position(35, 59, 24.567f);
oa << *g_ptr;

In my code zz_memory is just a plain base class, its tracking is not
changed, I have done some project wide searches for the tracking macros
and none exist, however the gps example is totaly fundamental and still
won't compile.

Cheers
Chris

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


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