究竟發生了什麼?從堆分配時堆棧溢出
#include <boost/array.hpp>
#include <boost/assign/list_of.hpp>
struct Toy {
int m_data[100000];
};
struct Box {
Box()
: m_toys( boost::assign::list_of(Toy())(Toy())(Toy()) )
{}
boost::array<Toy,3> m_toys;
};
void main()
{
Box* box = new Box; // This causes stack overflow
}
+1 for boost :: assign :: list_of。好點子! – 2010-11-26 14:34:55