so a std::vector<3DModel*> would work, and I just got adding pointers to it after I load the models? Then ofc, reminding to clean it all up after I'm done with them.
Type: Posts; User: Krones
so a std::vector<3DModel*> would work, and I just got adding pointers to it after I load the models? Then ofc, reminding to clean it all up after I'm done with them.
Even if b was a pointer, is b->model still valid, even if I change the vector models? Because it points to a region in the memory that may have been moved when the push_back was called.
The following should help to clarify. it's not actual code, but it shows what I'm trying to figure out.
struct Entity{
3DModel *model;
}
std::vector<3DModel> models;
Hi
I would like to know what is the best way (if there is one) to keep track of an element inside an STL vector.
Consider I have some big object 3D models, that take up a lot of space each,...
Ty! That was the answer I needed :) Thx a lot
Krones
When is it better doing each thing?
I'm just asking if it's better to copy data and free the pointer or if it's ok to point to it without freeing the pointer. Feel free to ignore the code if you think it contain errors, as long as you...
Assuming they are NULL-terminated strings. If you didn't get what I meant, use memcpy with a a random size then, I didn't want to come up with another variable. This is an _example_ code, it doesn't...
This:
struct example
{
unsigned char *storageArea;
unsigned char *storageArea2;
unsigned char storageArea3;
};
Because it needs to be processed first... A part of it will go to one storage area, then another part will go to another and so on. Then I may need to use storageArea = &packet[x] storageArea2 =...
Yep, but would it be more efficient than using a buffer? Estimate a length and memcpy the contents of the packet to the storage area and free(packet)?
Packet is the pointer that was set using malloc(), and storageArea is another pointer, where the data will be stored. If I do "storageArea = &packet[x]", "free(packet)" and then do something with...
I wanted to know the difference between using malloc() to allocate data to a pointer and creating an array[].
I'm writing a program that gets data from the internet and stores a part of it. It...