Jump to content
  • Advertisement
Sign in to follow this  
Icebone1000

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

This topic is 3044 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
Advertisement
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  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!