Hi all,
I am new to C++. What does it mean exactly to "new" a collection? For example:
UnicodeStringList* tmp = new UnicodeStringList;
// where UnicodeStringList is typedef to std::list<UnicodeString>
When you "new" something you have to know exactly how big you need it to be, right? So when I use the assignment constructor to copy an object, how will the computer know how much memory should be allocated on the heap? For example:
*tmp = another_string_list;
another_string_list is being copied into my new'd UnicodeStringList in heap memory, but I never initially specified how big that heap memory ought to be. And the compiler doesn't know how big another_string_list is so how much memory goes into the heap?
I am confused and hopefully I've specified my question enough so someone may understand me, but I'm not sure.
Please help
Thanks,
Julian