I have been working on an MFC SDI program whose Document actually has lists of lists (and possibly a list of a list of a list). I would like to get into a good habit and be consistent with the way I maintain collections (mostly lists, occasionally arrays and maps). Almost all my objects are derived from CObject (for serializing, etc.).
I guess it comes down to picking between CList<type, type>, CList<type, type&>, CList<type*, type*> and whatever other combinations. To keep sane, I think I always want to use CList<type*, type*>. That way, I just use the new operator at the point where an object needs to be instantiated and call delete on it (while traversing the list or sublist) at the 'outer' list's destructor.
I would like comments about this. Is it safe? Is it a decent practice to keep? How can I prevent double deleting the same objects (if that could even happen)? Does this choice affect how I code the required copy constructor and assignment operator (which always seem to involve references)?
Thanks in advance for any advice and comments!
Happy New Year,
When closing access database file objects in c++ I keep getting this error:- Debug Assertion Failed.
It happens as I close the CDaoDatabase object but I have noticed that when it is debugged and stepped over there are no errors.
I hope you are joking... the size of integers are only specified in realtive form (i.e. sizeof(char) <= sizeof(int) and so on).
Bitshifting based on static numbers are bound to fail.
Use comparisons instead (as in the post below).
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
My app is being developed in MFC, VC++7. How can I make my controls resizable ?? I mean, when an user clicks on the corner to make the window bigger or smaller... please if the piece of code could be provided it would be great!!
I have built a program with a listbox on the main dialog. I desire to use this listbox for multiple purposes, sometimes allowing the user to select an item out of it, othertimes not allowing them to select anything. What I am wondering, is it possible to have code within the program that changes the "selection" property of the listbox from "Single" to "None"?
(I'm new at VC++). I've been looking for an hour on how to do this. I am wondering could you give me an example of how I would do this? (I tried looking for things such as m_ListBox.SetStyle() but could not find anything?)