Jump to content
  • Advertisement
Sign in to follow this  
Tispe

Moving objects around

This topic is 2554 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

Hello

I am loading files into memory and have a pointer in a strcut point to it


struct RawFile
{
// pointer to buffer and size of buffer
unsigned int DataSize;
char* pData;
};


This object will get placed in a vector called UnprocessedFiles.

std::vector<RawFile> UnprocessedFiles;


Now, once in a while I want to run through the vector and process the content of each file and place that content in to another vector. Instead of making a new copy of the file in memory I wish only to add more members to the RawFile struct:

struct RawFile
{
// pointer to buffer and size of buffer
unsigned int DataSize;
char* pData;
bool IsProcessed;
MeshContainer* pMesh;
TextureContainer* pTextures;
};


Now comes my question, I wish to copy elements from one vector to another called ProcessedFiles.

//for loop
ProcessedFiles.push_back(UnprocessedFiles);


Now will this create a duplicate RawFile instance or will the same adress be copied?

Would the solution then to make a pointer to a RawFile and push_back that ?

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!