a list of lists

currently i use CArray to keep track of a list of objects, but I don't
know MFC classes well enough to keep track of a list of lists. I'd
appreciate some suggestions

0
ericwan78 (38)
8/19/2007 2:58:43 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
960 Views

Similar Articles

[PageSpeed] 14

"wanwan" <ericwan78@yahoo.com> ha scritto nel messaggio 
news:1187535523.924671.143350@j4g2000prf.googlegroups.com...
> currently i use CArray to keep track of a list of objects, but I don't
> know MFC classes well enough to keep track of a list of lists. I'd
> appreciate some suggestions

You might want to embedd your list based on CArray into a class (e.g. 
CListOfSomething), and then define a CArray storing instances of these class 
(or better: storing *pointers* to instances of these class: i.e. a CArray< 
CListOfSomething * >).
I don't know if things will be OK, but I think so.

If you would have problems, you may try STL containers (like std::vector or 
std::list).

Giovanni


0
8/19/2007 3:07:04 PM
On Aug 19, 11:07 am, "Giovanni Dicanio" <giovanni.dica...@invalid.it>
wrote:
> "wanwan" <ericwa...@yahoo.com> ha scritto nel messaggionews:1187535523.924671.143350@j4g2000prf.googlegroups.com...
>
> > currently i use CArray to keep track of a list of objects, but I don't
> > know MFC classes well enough to keep track of a list of lists. I'd
> > appreciate some suggestions
>
> You might want to embedd your list based on CArray into a class (e.g.
> CListOfSomething), and then define a CArray storing instances of these class
> (or better: storing *pointers* to instances of these class: i.e. a CArray<
> CListOfSomething * >).
> I don't know if things will be OK, but I think so.
>
> If you would have problems, you may try STL containers (like std::vector or
> std::list).
>
> Giovanni

I just found this class and figured out an approach. Hope it works:

CPtrArray g_ListOfLists;
....
CArray<CMyClass>* list;
list = new CArray<CMyClass>();
// add list
CMyClass myObj = CMyClass();
list->add(myObj);

g_ListOfList->add(list);

0
ericwan78 (38)
8/20/2007 12:22:21 AM
"wanwan" <ericwan78@yahoo.com> ha scritto nel messaggio 
news:1187569341.961945.261590@i38g2000prf.googlegroups.com...

> I just found this class and figured out an approach. Hope it works:
>
> CPtrArray g_ListOfLists;

IIRC, CPtrArray stores array of void pointers, so it is basically an 
*unsafe* container (a void pointer can point to anything; you could put in 
the array both apples and bombs...). I think that void pointers are 
sometimes useful (e.g. COM's IUnknown::QueryInterface uses void pointers), 
but IMHO you should avoid void pointers whenever you can, because of their 
type-unsafety.

CPtrArray could have been useful in the pre-template era, but with the 
introduction of C++ templates, you can have both generic containers and 
tape-safety.
(I'm not a big fan of templates, I use them "with care", in particular for 
generic containers with type-safety check at compile-time - I tend stay away 
from other really advanced stuff like template metaprogramming or some of 
Alexandrescu's template "black-magic"... templates can be hard to debug, 
error messages from the compiler tend to be cryptic, etc.)

CArray is a template container from MFC, and std::vector is from STL.


> CArray<CMyClass>* list;

If CMyClass is a big object, you may want to store *_pointers_ to CMyClass* 
in the CArray (to avoid performance loss due e.g. to deep-copy of object 
instances - of course, if you use pointers, you should pay attention to free 
their memory, to avoid memory leaks).
i.e. CArray< CMyClass * >

or if you use STL vector:

<code>
typedef std::vector< CMyClass * > ListOfMyClass;

ListOfMyClass theList;
</code>


> CMyClass myObj = CMyClass();

This is not very good C++, IMHO...

CMyClass myObj; // default constructor

is just fine.

Giovanni


0
8/20/2007 8:38:16 AM
Reply:

Similar Artilces:

Better to "nest" or use multi-level list?
I'm in the process of creating/defining a style(s) for a list that will be numbered in "level 1" and have indented bullets in "level 2." For such a list is it better to define a multi-level list style and linked paragraph styles? Or use one's already defined numbered list and use one of the Word's pre-defined bullet lists when needed for the second level? As part of this question, is is preferable not to have a style "nested" within another style or doesn't it matter? Thank you. -- Norm Hi Norm: I'm not sure why yo...

Distribution List Changes
Hi All, I have a mail enabled distribution list with four users. Only those users plus the Administrator have rights on this group. Yet a seperate user is able to add / edit or remove users to this group even though they do not belong to this group. The user does not even have admin rights and is able to make changes. Let me know of any options I can try. Thanks Waynear wrote: > Hi All, > > I have a mail enabled distribution list with four users. Only those > users plus the Administrator have rights on this group. > > Yet a seperate user is able to add / edit or remov...

Customizing Activities\History LIst
Is there a way to add a date to Activities' History list? It would be nice to know when each activity happened. Thanks, Troy Troy, no way currently, although Microsoft has mentioned it might be an option in version 2.0 (nothing is guaranteed!) A few ISVs have custom products that do it... www.salentica.com www.c360.com Dave "Troy" <anonymous@discussions.microsoft.com> wrote in message news:af6b01c436bd$ce671f00$a001280a@phx.gbl... > Is there a way to add a date to Activities' History > list? It would be nice to know when each activity > happened. >...

Sound shows on custom Annimation list yet no sound heard
When the PP Presentation is saved as a show,some slides have sound and some do not. All sound came from the same folder. Also, when playing the slides while in PPPresentation, swome have sound and some do not despite all being indicated on custom annimation lisy and all startin "after previous." Thanks! Often when one sound plays but another doesn't, it's an issue of the length of the file path. What's the file path to your music? Is it really long? If so, the longer-named songs might just be hitting the length limit. -- Echo [MS PPT MVP] http://www.ec...

Drop Down List and Check Box
Hi...I was search for this topic but don`t found the solve...Anyway I have a drop down list like this [image: http://www.geocities.com/augurtrade/excel_checkbox.txt] and this [image: http://www.geocities.com/augurtrade/excel_checkbox2.txt] ok my questions is what is (Blanks) and (NonBlanks)...? Is it possible for me to see only all the check box that was checked or vice versa...??? How to make a total below the checkbox i mean when someone check the check box, a total number appear below the last check box [image: http://www.geocities.com/augurtrade/excel_checkbox3.txt] [image: http://www.g...

how reliable is the "Who has you in their contact list" list?
Because someone who I think has recently (within the last week) deleted me is still on this list (I don't think she blocked me), but when I check who deleted me on blockstatus.com, he shows up. could it be it's not updated? which of the two would be more reliable? -- maykk Greetings, Do not use these websites, they will steal your identity and sell it. You should change your password immediately. That said, in general, the "who has..." list within Messenger is accurate. There have been instances over the last six-months or so where the list (and m...

Selecting from contacts list
I have all my contacts in the Contacts List and I want to delete all those with a common extension i.e. all those who have email addresses @hotmail. I am using Outlook 2007 Can you do a search or advanced search which will show the contact you want to delete? You should be able to highlight & delete them from the results. "GrahamC" <GrahamC@discussions.microsoft.com> wrote in message news:6AC1880D-9632-4ED9-BAE2-7083690B9FA7@microsoft.com... > I have all my contacts in the Contacts List and I want to delete all those > with a common extension i.e. all t...

Script to list access right
Hi I am trying to find any script which would generate list of login users with certain access level (select, write etc.) at one particular database. Is there something like that? Thanks. Justin ...

a list of lists
currently i use CArray to keep track of a list of objects, but I don't know MFC classes well enough to keep track of a list of lists. I'd appreciate some suggestions "wanwan" <ericwan78@yahoo.com> ha scritto nel messaggio news:1187535523.924671.143350@j4g2000prf.googlegroups.com... > currently i use CArray to keep track of a list of objects, but I don't > know MFC classes well enough to keep track of a list of lists. I'd > appreciate some suggestions You might want to embedd your list based on CArray into a class (e.g. CListOfSomething), and then ...

Smart List export to Excel #2
Hi, We are using Dynamics 9.0 and Office 2003. When we try to do a Smart List export to Excel, we keep getting an "Exception_Class_Object_Exception" that references varying object errors, such as 'Cells' or 'Value'; the object errors will change each time we try an export. As a workaround, I've found that closing Excel before doing the export allows the export to complete successfully. However, that solution isn't acceptable, as our Dynamics users would like to be able to work in Excel, doing other tasks, while the export is processing. Does anyone...

List of different values in data area
Hi excel specialists, How Can I automatically get the list of different values from the dat area and to find out their frequence? INDIVIDUALLY MEASURED VALUES: 3,5 4 3,5 4 3 3,5 4 4 3 3,5 4 3 3,5 3 3 3,5 4 4 Thanks for your help in advance. Balcovja -- balcovj ----------------------------------------------------------------------- balcovja's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2623 View this thread: http://www.excelforum.com/showthread.php?threadid=39572 Take a look at FREQUENCY in Hep -- HTH RP (remove nothere from the email address if m...

Global Address List and Handhelds
We use Ipaqs throughout the company, and I was wondering if there is anyway to have exchange add the GAL to the outlook contacts on the workstation, so that when they sync up, they will retrieve the Global Address List? In news:%23TkYtT0$GHA.3560@TK2MSFTNGP04.phx.gbl, Flip <phil.atkinson@beltek.com> typed: > We use Ipaqs throughout the company, and I was wondering if there is > anyway to have exchange add the GAL to the outlook contacts on the > workstation, so that when they sync up, they will retrieve the Global > Address List? No (and this wouldn't really be an ...

Fields in items list-- add/delete
Hai, I am using RMS version 1.2. In Stores Operations Manager it displays list of items when click on Database-->Items. It displays only five columns. Now i need to add / delete some fields in this list. Is it possible to add or delete the fields? if yes how can i add the fields? Thanks in advance, Nagendra On Wed, 27 Apr 2005 01:22:02 -0700, "Nagendra" <Nagendra@discussions.microsoft.com> wrote: >Is it possible to add or delete the fields? if yes how can i add the fields? I don't think so antonio ...

remove small list from large list
I have two mail lists on excel. The first has 16,000 names, the second has about 6,000. I need to remove the 6,000 from the 16,000 as they all appear in the big list as well. How do I extract those 6,000 entries from the larger list? My expected result is a mailing list with 10,000 names. Chip Pearson has some techniques at: http://www.cpearson.com/excel/duplicat.htm Howie J. wrote: > > I have two mail lists on excel. The first has 16,000 names, the second has > about 6,000. I need to remove the 6,000 from the 16,000 as they all appear > in the big list as well. How do ...

To-do list
In Outlook 2007, I can't find a way to show a short summary of my e-mail inbox on my Calendar page, similar to the way Outlook shows a To-do list of calendar items on my Mail page. It would save me a lot of switching back and forth. If there is a way, please tell me. If not, maybe you could consider adding it to the next version of Outlook. Otherwise, I love the program. -- BB ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the mes...

exception list
where can I find the exception list for intelligent message filtering? Global Settings in ESM Nue "jlconley" <jlconley@discussions.microsoft.com> wrote in message news:DDF580F1-71C4-4A59-B502-5736266E74AD@microsoft.com... > where can I find the exception list for intelligent message filtering? Not sure what you mean - there's no exception list as such. You can insert IP addresses of known/trusted hosts (from customers/partners and such.. ) in Connection Filtering's Global Accept/Deny lists and these will bypass all other filters. Will need to enable Connect...

Conditional Formatting w/ a List/Icons
I am trying to allow someone to select "Green", "Yellow" or "Red" from a list and the cell to display a green/yellow/red icon appropriately. Or, if possible, the user could just select the icon (instead of selecting text). Is this possible? Use Data Validation for the list. Type in Red, Yellow, Green as the list. This give the user the list to select from. Use Conditional Formatting for the fill part. Set three conditions, If Cell Value-"Green" (select a green fill), etc.. -- If this helps, please remember to click yes. "...

Email Distribution List
When I send a email form my Distribution List - All contacts in that list will get email 7-15 times, untill I deleat from the outbox. How do I fix? "Steve" <Steve@discussions.microsoft.com> wrote in message news:385F5F26-5C60-467C-A6D7-FBD57E7F82EB@microsoft.com... > When I send a email form my Distribution List - All contacts in that list > will get email 7-15 times, untill I deleat from the outbox. How do I fix? This is usually caused by scanning your mail with an antivirus program. Uninstall your AV program and reinstall it without the mail scanning feat...

Pivot Field List
I was wondering if there is an easy way to locate a specific field in the pivot field list in Excel 2007 without having to scroll the list of fields and find the one you are looking for if you have many? I know in 2003 you were able to start typeing the word or numeric and it would find the first match as you typed. Excel 2007 PivotTable Expanded, auto-complete PivotItem drop-down list in RowField. With macro. http://c0718892.cdn.cloudfiles.rackspacecloud.com/04_14_10.xlsm Pdf preview: http://www.mediafire.com/file/mewgzmiwzyd/04_14_10.pdf ...

Modify the Edit List
I need to know if I modify how the Payables Transaction Edit List prints out will it make the same changes for the Payables Transaction Posting Journal? -- TC TC, Two different reports, two different modifications, two different security settings. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC http://www.maximumglobalbusiness.com "TC" wrote: > I need to know if I modify how the Payables Transaction Edit List prints out > will it make the same changes for the Payables Transaction Posting Journal? > -- > TC Thank you Mariano. ...

How to extract/filter unique records from 2 lists?
I have 2 lists, say List A with 300 entries and List B with 320 entries. List A's entries are all in List B and I want to know what are the 20 different entries in List B. Short of manually eyeballing both lists, how do I extract or filter out those 20 unique records? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ Enter this formula in C1 to see if the value in B1 is there in the list A1:A300 =IF(ISERROR(MATCH(B1,$A$1:$A$300,0)),"Not There","There&...

distribution list #33
This is a multi-part message in MIME format. ------=_NextPart_000_006F_01C66557.FDC0A9E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit .. is it possible setup so each recipient sees their respective email with rest of recipients undisclosed. Apart from insert "list name "using bcc and it recipient seeing an email sent to yourself? Thanks ------=_NextPart_000_006F_01C66557.FDC0A9E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:...

Purchase Requisition Templates (for Direct Market List)
I am the MIS Manager for the Pan Pacific Hotel KLIA, Sepang, Malaysia. We are evaluating the inventory module in Great Plains. 1. Most of the other inventory systems have templates that we can use to create what we in the industry call 'Daily Market List'. These are perisable items that are 'normally' requisitioned by the Kitchen for their day-to-day usage. These are not items that will be held in the store on a regular basis. For e.g. chicken, beef, vegetables................It is also normal practice to send out request for quotations for these predetermined peri...

MSN Stock Watch List in Money 2006 Deluxe Portfolio Manager
I inadvertently deleted the MSN Stock Watch list from my Portfolio Manager. Now, despite the list still being in existence under my Passport, I cannot seem to restore it intact into Portfolio Manager via either Money 2006 Deluxe or MSN Money. I'd greatly appreciate any insight from those who may know how to restore this list as an active Portfolio Manager account, which would be much more preferable to creating a new watch list, which would not only not auto-sync with the entries made from the MSN pages, but would also require re-entry of the huge list I have now. I really want m...

Updating/Synchronizing Address/Contacts List
I am in a new position and have been presented an ongoing issue. In the Address Book for Outlook, there are multiple Contacts lists. The structure is Recipients, All Address Lists, All Contacts. There are several folders under All Contacts where detailed contact information is kept. The problem is that the contacts are not updating or synchronizing. Does anyone know what the issue would be or what I can check on this system to make sure they are synching? Thanks in advance! Is this Exchange 2003? When you say the contacts are not updating where should the updates be coming from...