insert the following two lines at the beginng of your program #include <boost/config.hpp> #define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP and your program will compile. The above two lines supresses usage of ADL with vc 7.1 . I'm not sure what the circumstances are so I can't make a small test case. I'm am coming to believe that ADL on VC 7.1 is broken. The solution above isn't a good one but it does illustrate the source of the problem. Good Luck, Robert Ramey "Malte Clasen" <news@copro.org> wrote in message news:co5ubm$cbc$1@sea.gmane.org...
Robert Ramey wrote:
The pimpl example demonstrates pretty much all I know about the issue.
Ok, I'm using that one now and it compiles fine.
But another issue appeared: The automatic serialization of nested std::vectors fails under certain circumstances. I managed to isolate the problem to the following case:
----------
// disable warnings that don't matter in this example #pragma warning(disable:4511 4512 4244 4100 4267)
#include <boost/serialization/serialization.hpp> #include <boost/serialization/shared_ptr.hpp> #include <boost/serialization/vector.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp>
#include <fstream> #include <vector>
class A { private: friend class boost::serialization::access; template<class Archive> void serialize(Archive &, const unsigned int) {} };
template<typename T> class B { private: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int /*version*/) { //ar.register_type< std::vector<T> >(); // workaround A //ar & vT; // workaround B, part 1/2 ar & vvT; // this one fails }
//std::vector<T> vT; // workaround B, part 2/2 std::vector< std::vector<T> > vvT; };
void save() { std::ofstream ofs("test.dat"); boost::archive::text_oarchive oa(ofs);
B< boost::shared_ptr<A> > b_ptr_a; oa << b_ptr_a; }
void load() { std::ifstream ifs("test.dat"); boost::archive::text_iarchive ia(ifs);
B< boost::shared_ptr<A> > b_ptr_a; ia >> b_ptr_a; }
----------
The serialization of std::vector< std::vector<T> > fails to compile (VC++ 7.1) unless one of the workarounds is used, that means some kind of registration of std::vector<T>. Is that a known limitation? I found nothing in the documentation about this case, but perhaps I overlooked something.
Malte