
I am curious why loading a vector of items from an input stream fails using one method but works using a slightly different method. Given a load method: template <class T> T* load(std::istream& in) { boost::archive::xml_iarchive ia(in); T* t; ia & BOOST_SERIALIZATION_NVP(t); return t; } and use of it: vector<item>* v = load<vector<item> >(std::cin); I get: uncaught exception: stream error But, when I use this load method: template<class T> void load(std::istream& in, std::vector<T*>& v) { boost::archive::xml_iarchive ia(in); ia >> BOOST_SERIALIZATION_NVP(v); } and use it so: vector<item> v; load(std::cin, v); it works perfectly. Is there some reason the first method should fail? Bill