Hello, I have a simple program to test boost::variant. Under Visual C++ 2005, configuration Release (/MD), the build fails with C1060 (out of heap space). The program compiles and runs as expected under Visual C++ 2005 Debug (/MTd), and under Visual C++ 2008 Express, Release and Debug. Below is the code. Any idea what's wrong? Many Thanks, Eric #include <set> #include <string> #include <vector> #include <iostream> #include <fstream> #include <map> #include <boost/variant.hpp> #include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_oarchive.hpp> #include <boost/serialization/variant.hpp> #include <boost/serialization/vector.hpp> #include <boost/serialization/map.hpp> struct empty_property_tag { template<class Archive> void serialize(Archive &ar, const unsigned int) {} }; typedef boost::make_recursive_variant<empty_property_tag, std::string, long, double, std::vector<bool>, std::vector<long>, std::vector<double>, std::vector<std::string>, std::vector<std::vector<bool> >, std::vector<std::vector<long>
, std::vector<std::vector<double> >, std::vector<std::vector<std::string> >, std::vector<boost::recursive_variant_>, std::vector<std::vector<boost::recursive_variant_> > >::type property_t;
class print_visitor : public boost::static_visitor<> { std::string m_indent; public: print_visitor(const std::string& indent) : m_indent(indent) {} print_visitor(const print_visitor& p) : m_indent(p.m_indent) {} void operator()(const bool& i) const { std::cout << m_indent << "It's an bool: " << i << '\n'; } void operator()(const std::string& s) const { std::cout << m_indent << "It's a std::string: " << s << '\n'; } void operator()(const double& d) const { std::cout << m_indent << "It's a double: " << d << '\n'; } void operator()(const long& d) const { std::cout << m_indent << "It's a long: " << d << '\n'; } void operator()(const empty_property_tag& e) const { std::cout << m_indent << "It's an empty_property_tag.\n"; } void operator()(std::vector<property_t>& v) const { print_visitor p(m_indent + "\t"); std::cout << m_indent << "It is a vector of size: " << v.size() << "\n"; for(std::vector<property_t>::iterator i = v.begin(); i != v.end(); ++i) boost::apply_visitor(p, *i); } void operator()(std::vector<std::vector<property_t> >& v) const { print_visitor p(m_indent + "\t"); std::cout << m_indent << "It is a vector of of vectors size: " << v.size() << "\n"; for(std::vector<std::vector<property_t> >::iterator i = v.begin(); i != v.end(); ++i) operator()(*i); } template <typename T> void operator()(std::vector<T>& v) const { std::cout << m_indent << "It is a vector of size: " << v.size() << "\n"; for(typename std::vector<T>::iterator i = v.begin(); i != v.end(); ++i) std::cout << m_indent << '\t' << *i << '\n'; } template<typename T> void operator()(std::vector<std::vector<T> >& v) const { print_visitor p(m_indent + "\t"); std::cout << m_indent << "It is a vector of size: " << v.size() << "\n"; for(typename std::vector<std::vector<T> >::iterator i = v.begin(); i != v.end(); ++i) operator()<T>(*i); } }; void main() { property_t q = "aaa"; print_visitor p(""); boost::apply_visitor(p, q); }