Sign in to follow this  

Simple question about vector initialization "sequence", its possible?

This topic is 2864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

struct MyFaces{
	std::vector< vposnormaltex > vertexElmN;//vertex element(pos, normal, tex)
	UINT ID;
};
struct MyGroups{
	std::vector< MyFaces > faceN;
	UINT ID;
};
struct MyMeshs{
	std::vector< MyGroups > groupN;
	UINT ID;
};
std::vector< MyMeshs > MeshN;

Theres a way to initialize at once a single Mesh that recevives a single Group that receives a single Face that receives a vector of vertices? I just got too confused with the abstraction.. //vCube is a filled vector MeshN[0] = MyMeshs( MyGroups( MyFaces( vCube, ID_1 ), ID_1 ), ID_1 ) ;

Share this post


Link to post
Share on other sites
If you had the appropriate constructors defined, then you could push_back() like so:

MeshN[0].push_back(MyMeshs( MyGroups( MyFaces( vCube, ID_1 ), ID_1 ), ID_1 ));


Remember, you must push_back() or otherwise resize() the vector before you can use operator[] with it.

Share this post


Link to post
Share on other sites
Sign in to follow this