473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

container inside container in stl

Hi
Me being a beginner in c++ , i just want to know is their
anything special i have to take care when using container inside a
container.

eg:
vector inside a map which is inside a map

When i googled i found out people saying about memory leaking. Is this
true ?
I know about issues of holding pointer inside a vector and forgetting
to delete it. I am asking for any thing else. Thanks in advance

Regards
Kiran Pradeep

Jul 24 '06 #1
2 1600
wolverine wrote:
Hi
Me being a beginner in c++ , i just want to know is their
anything special i have to take care when using container inside a
container.

eg:
vector inside a map which is inside a map
Nope: nothing special.
>
When i googled i found out people saying about memory leaking. Is this
true ?
I do not know of any implementation of the standard library that leaks
memory. However, it is popular to use pooling allocators so that memory
allocated for containers is kept around; e.g., deleting an element in a map
may not shrink the memory use of your program but that location of memory
will be used next time, when you insert an element.
I know about issues of holding pointer inside a vector and forgetting
to delete it. I am asking for any thing else.
Huh?
Best

Kai-Uwe Bux
Jul 24 '06 #2
Kai-Uwe Bux <jk********@gmx.netwrote:
wolverine wrote:
>I know about issues of holding pointer inside a vector and forgetting
to delete it. I am asking for any thing else.

Huh?
I think what the OP is saying is that he is aware of the memory leak
issue if you do something like:

std::vector<int*vip;
vip.push_back(new int(3));

but then fail to do the equivalent of:

delete vip[0];

before the vector itself is destroyed.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jul 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aliensite | last post by:
I am trying to have a container div generated by the DOM, hold everything inside the body. I can't get it to hold the contents in the body. <html><head> <style type="text/css"> body {...
7
by: toton | last post by:
Hi, I want a circular buffer or queue like container (queue with array implementation). Moreover I want random access over the elements. And addition at tail and remove from head need to be low...
1
by: Graham | last post by:
Hi, I am trying to write a custom email form control that doesn't require programming experiance in order to implement (for our html guys). I have a base design that I would like to use for the...
1
by: Sjef | last post by:
I am trying to understand the deeper meanings of containers. One would say: everything inside the container div will stay inside, but apparently that's not true. My test code is below. When I...
4
by: Rares Vernica | last post by:
Hi, How can I save a reference inside a container? For example I have: map<string, unsignedX; I would like to be able to save a reference to a position inside X. For a vector, the...
2
by: Daniel Lipovetsky | last post by:
I would like for an object to "report" to a container object when a new instance is created or deleted. I could have a container object that is called when a new instance is created, as below. ...
4
by: Doc John | last post by:
I have a "global" MDI which will contain everything in the application. Since the application itslef will include three different "environments" with their own child Forms, I was wondering if I...
18
by: Goran | last post by:
Hi @ all! Again one small question due to my shakiness of what to use... What is better / smarter? private: vector<MyClass_t* itsVector; OR...
7
by: Marcolino | last post by:
Hi, another question for you. I looked around but found nothing. I have a MDI container calld frmMDIMain, that contain some child form....one of that forms is called frmPostIt and I need that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.