Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-11-12 03:54:09


Robert Ramey wrote:

>>Also, the natuaral syntax at the top of that section seems correct to me.
>>If it is really not possible, then it should be told why.
>
>
> Well, As I said in the documentation, the cited syntax seems correct to me
> as well. I couldn't get it to compile in multiple environments. No one
> has been able to explain it to me either. If anyone knows why, I will
> add the expanation.

Would you care to try this syntax again some day and tell
what errors you get, so that other might look. As it stands, lack
of explanation is bad indeed.

>> What is your evaluation of the implementation?
>
>
>>There's missing typename at
>
> ../../boost/serialization/stl.hpp:124
>
> in my copy, line 124 is a blank

:-/
I don't see this warning anymore. Probably, I got it on the
previous version. However, now I get:

test.cpp: In constructor `F<Container, Compare>::F()':
test.cpp:698: parse error before `=' token
test.cpp: In member function `void F<Container,
    Compare>::save(boost::basic_oarchive&) const':
test.cpp:744: parse error before `>' token
test.cpp: In member function `void F<Container,
    Compare>::load(boost::basic_iarchive&, unsigned char)':
test.cpp:754: parse error before `>' token
test.cpp: In constructor `F<Container, Compare>::F() [with Container =
    std::set<A*, ptr_less<A*>, std::allocator<A*> >, Compare = A]':
test.cpp:1266: instantiated from `int outer_test(TS) [with TS = char_test]'
test.cpp:1348: instantiated from here
test.cpp:701: `t' undeclared (first use this function)
test.cpp:701: (Each undeclared identifier is reported only once for each
    function it appears in.)

>>And, BTW, is
>>typeid of *t is not equal to static type of *t, then *t is
>>already polymorphic, unless I'm missing something.
>
>
> Its only polymorphic if it has at least one virtual function.
> if it doesn't have at least one virtual function then dynamic_cast
> fails for lack of a vtable.

Eeh... if the class is not polymorphic, then, given pointer to base, you
have no way to find the derived class. typeid would return static type of
pointer, and you're doing the assert only if base_type != derived_type, which
already implies that type is polymorphic. How can they be unequal otherwise?

>>> What is your evaluation of the documentation?
>>
>
>>Documentation does not say that "version" must be *static* member
>>function.
>
>
> because it doesn't have to be a static member function. In can be
> a member function or a virtual member function.

Using the example I've sent previously: if I change A::version to be
nonstatic, I get this error:

../../boost/serialization/serialization_imp.hpp: In static member function
    `static version_type serialization<T>::version(const T&) [with T = A]':
../../boost/serialization/serialization_imp.hpp:172: instantiated from `version_type boost::serialization_detail::version_template(T&, int) [with T = A]'
../../boost/serialization/serialization_imp.hpp:279: instantiated from `version_type boost::serialization_detail::type_info_class_save<T>::version_object(void*) const [with T = A]'
/home/ghost/Work/boost/boost/mpl/if.hpp:59: instantiated from here
../../boost/serialization/serialization_imp.hpp:101: passing `const A' as
    `this' argument of `int A::version()' discards qualifiers

>>Rationale section talks about "saved objects must be const". I don't
>>understand what this means, and the example from reference for this
>>part compiles fine for me, while docs say it should not.
>
>
> hmmm - I'll refrase to "Save functions must be const"
> Of course save objects don't have to be const, The save function
> must specify const so the serialization process doesn't change them.

Then, I believe you should remove parts that talk about safety. Making
save function consts is as natural as taking const reference in operator<<.
Everybody would agree to that.

>> Did you try to use the library? With what compiler? Did you
>> have any problems?
>
>
>>Yes, with g++ 2.95.4 and 3.2 (although lack of Jamfile required manual compilation).
>>It did not compile, saying that:
>
>
>>./../boost/void_cast.hpp:28: redefinition of `struct boost::is_polymorphic<T>'
>>/home/ghost/Work/boost/boost/type_traits/is_polymorphic.hpp:75: previous
>> definition of `struct boost::is_polymorphic<T>'
>>In file included from ../../boost/serialization/serialization_imp.hpp:16,
>> from ../../boost/serialization/archive.hpp:4,
>
> > from archive.cpp:17:
>
>>./../boost/void_cast.hpp:28: redefinition of `struct boost::is_polymorphic<T>'
>
>
> hmmm - my copy of boost_1_29_0 has no "is_polymorphic.hpp" in the type_traits
> directory. I only downloaded this 10 days ago. Is there a 1_29_1 that I should
> be using?

I was using CVS version. I think that since you're be adding your library
to CVS if it's accepted, you'd want to test with CVS version too.

> Vladimir and I have has a spirted discussion on this issue for sometime.
> I understand his desire, but, after much effort, I have been unable to
> find any way to implement what he desires. Furthermore, I have come
> to the conclusion that it is logically impossible to do so - see last
> (unanswered) post.

About to answer right now. Thanks for nudging.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk