Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-05-06 04:54:50

Hi Robert,
I've just updated by Boost tree and run in a number of compile errors.

One is pretty easy -- I've committed the attached trivial patch to

Another is this:

....boost/boost/archive/detail/oserializer.hpp:551: error: incomplete
   type `boost::STATIC_ASSERTION_FAILURE<false>' does not have member `value'

instantiated from this code of mine:

        ofstream ofs(av[2]);
        boost::archive::binary_oarchive oa(ofs);
        oa << *data_builder.finish();

Where 'finish' returns auto_ptr<Data>. It's looks like serialization checks if
the serialized type is 'const' and if not, complains. Basically, it's some
heuritic to prevent saving on-stack object (though I don't understand why it
would work at al).

I find this a bit too much . I have no reason whatsoever to make 'finish'
return auto_ptr<const Data>. And writing

        oa << const_cast<const Data&>(*data_builder.finish());

looks very strange. And modifying all places where I get this error is not
nice too. So, can this static assert be removed?

Then, I get ambiguity in iserializer.hpp, in this code:

template<class Archive, class T>
inline void load(Archive &ar, const serialization::nvp<T> &t){
    load(ar, const_cast<serialization::nvp<T> &>(t));

For some reason, both boost::archive::load and some other 'load' in 'boost'
namespace (part of earlier serialization lib) that I still use are considered
overload candidates. Adding explicit boost::archive:: fixes this. See
attached patch.

Then I get error at this code:

    ar << boost::lexical_cast<std::string>(*this);

The error message is:

error: no match for 'operator<<' in 'ar <<
   boost::lexical_cast(Source) [with Target = std::basic_string<char,
   std::char_traits<char>, std::allocator<char> >, Source =
/space/NM/boost/boost/archive/detail/interface_oarchive.hpp:75: error:
   are: Archive&
   boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T
   = std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
   Archive = boost::archive::binary_oarchive]
   ...unrelated operator<< definitions snipped...

Apparently, passing rvalue to "T&" does not work. Yes another attached patch
fixes this issue.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at