Sign in to follow this  
Icebone1000

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this