|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2006-02-28 11:18:32
Tobias Combe wrote:
> Hello
>
> I read the documention and some prior postings to related topics.
> But none of the proposed solutions seems to work for me.
>
> My problem:
>
> I have an abstarct base class(with pure vitual function) and several
> derived from that. All are written in the same source/header -file. I
> want to serialize an object via a pointer to the base-class.
> When i use "ar.register<derived>();" in the template of the base-class
> to register the derived classes, i get a syntax error.
what syntax error do you get? conforming compilers can't compile
ar.register<derived>()
but need ar.template register<derived>() (or something like that). To
avoid have to remember this I use the following idiot proof syntax:
ar.register(static_cast<derived *>(0))
> When i export them with "BOOST_CLASS_EXPORT(derived);" or
> BOOST_CLASS_EXPORT_GUID(derived,"derived") it doesn't work (i think
> because they are all in the same file).
In order for BOOST_CLASS_EXPORT to function - it has to follow the
the boost/archive/... declarations.
> I'm also using "BOOST_IS_ABSTRACT(base);"
and...?
> When i comment "oa << object;" ervything compiles fine.
> Uncommented i get a:
> boost/archive/detail/oserializer.hpp:567: error: incomplete type `
> boost::STATIC_ASSERTION_FAILURE<false>' does not have member `value'
> error...
This is an entirely separate issue. Check the comments at oserializer.hpp
567 and
the documentation rationale for information on this topic.
Robert Ramey
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