Click here to Skip to main content
15,905,874 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionAdding a dialog in resource as child window at runtime? Pin
Gyan Prakash3-Oct-07 21:44
Gyan Prakash3-Oct-07 21:44 
QuestionVector Pin
mcsherry3-Oct-07 5:17
mcsherry3-Oct-07 5:17 
AnswerRe: Vector Pin
Chris Losinger3-Oct-07 5:36
professionalChris Losinger3-Oct-07 5:36 
GeneralRe: Vector Pin
mcsherry3-Oct-07 5:47
mcsherry3-Oct-07 5:47 
GeneralRe: Vector Pin
mcsherry3-Oct-07 5:54
mcsherry3-Oct-07 5:54 
GeneralRe: Vector Pin
Chris Losinger3-Oct-07 6:11
professionalChris Losinger3-Oct-07 6:11 
GeneralRe: Vector Pin
Nemanja Trifunovic3-Oct-07 7:47
Nemanja Trifunovic3-Oct-07 7:47 
AnswerRe: Vector Pin
Nathan Holt at EMOM3-Oct-07 11:10
Nathan Holt at EMOM3-Oct-07 11:10 
mcsherry wrote:
I currently use a vector to store a set of records. However there is now a limit to the number of elements the vector contains and once it is filled we have to remove the first element and insert the new one at the back. But as an added complication we aren't allowed any dynamic memory allocation so what needs to be done is:
1) Remove first element from list but do not free it's memory
2) overwrite the removed elements data with the new data
3) insert the updated element to the end of the vector

What is the best way to do this? I am not limited to only storing the data in a vector so if any other containers are more suitable then let me know!


I don't think STL provides any class that specificly avoids dynamic memory allocation, but ther is the notion of an allocator class which could be designed to just manage members of a fixed sized array. It might be simpler to not use an STL container. Boost might have the kind of class your looking for.

Failing that, you could implement your own class that does this. It would require an array, a first element index, and either a last element index of a content count. When the array gets full, you could update the first element index and assign a new value to the former first element.

Nathan
AnswerRe: Vector Pin
John R. Shaw6-Oct-07 0:55
John R. Shaw6-Oct-07 0:55 
QuestionHow to detect page refresh in vc++ Pin
rindam3-Oct-07 3:19
rindam3-Oct-07 3:19 
Questionsending sms through aspx.cs code in c# Pin
sh_india61@yahoo.com3-Oct-07 2:39
sh_india61@yahoo.com3-Oct-07 2:39 
AnswerRe: sending sms through aspx.cs code in c# Pin
vadivelub7-Apr-09 5:07
vadivelub7-Apr-09 5:07 
QuestionString problem Pin
david bagaturia1-Oct-07 22:19
david bagaturia1-Oct-07 22:19 
AnswerRe: String problem Pin
Jonas Larsson2-Oct-07 0:49
Jonas Larsson2-Oct-07 0:49 
GeneralRe: String problem Pin
david bagaturia2-Oct-07 3:38
david bagaturia2-Oct-07 3:38 
GeneralRe: String problem Pin
Stephen Hewitt2-Oct-07 4:43
Stephen Hewitt2-Oct-07 4:43 
GeneralRe: String problem Pin
Jonas Larsson2-Oct-07 21:58
Jonas Larsson2-Oct-07 21:58 
GeneralRe: String problem Pin
david bagaturia3-Oct-07 0:03
david bagaturia3-Oct-07 0:03 
AnswerRe: String problem Pin
John R. Shaw6-Oct-07 1:04
John R. Shaw6-Oct-07 1:04 
Questionwhere is the mistake here? Pin
rindam1-Oct-07 3:02
rindam1-Oct-07 3:02 
AnswerRe: where is the mistake here? Pin
led mike1-Oct-07 4:54
led mike1-Oct-07 4:54 
QuestionHow to print the cookie value Pin
rindam1-Oct-07 0:52
rindam1-Oct-07 0:52 
AnswerRe: reading cookie vakue in vc++ Pin
david bagaturia1-Oct-07 22:36
david bagaturia1-Oct-07 22:36 
QuestionInternetGetCookie returning false always,plz help me to read cookie value from VC++ Pin
rindam30-Sep-07 19:07
rindam30-Sep-07 19:07 
AnswerRe: InternetGetCookie returning false always,plz help me to read cookie value from VC++ Pin
Stuart Dootson30-Sep-07 20:49
professionalStuart Dootson30-Sep-07 20:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.