0
struct vertex
{
th::Vector3 point[2];
std::list<vertex>::iterator pointConnection[2];
};
std::list<vertex> vertices;
vertices.push_back(
{{vertex1->_getDerivedPosition(), vertex2->_getDerivedPosition()},
{vertices.end(), vertices.end()}}
);
我無法找到一個原因,爲什麼這不起作用,而下面的編譯罰款?你能解釋一下嗎?我究竟做錯了什麼?就地初始化std容器中的結構體
vertex v = {{vertex1->_getDerivedPosition(), vertex2->_getDerivedPosition()},
{vertices.end(), vertices.end()};
'vertex'不是POD類型,因爲它的成員不是POD類型 – 2013-03-09 17:36:39
@TonyTheLion我編輯了這個問題。我忘了那裏的vector3和迭代器。當我準備問題時,結構非常不同。詢問之前一直在嘗試不同的事情。 – Etherealone 2013-03-09 17:37:40
不過,如果第二個工作,是不是把這push_back應該工作?我一直在這個問題上有很長時間的問題,我第一次做不到。 如果不是POD,我需要一個構造函數並使用emplace嗎?構造函數會有很大的性能損失,因爲這會很快完成。 – Etherealone 2013-03-09 17:40:18