Map of Lists
Manolis Chr.Papadopoulos -- papadop@metal.ntua.gr Wednesday, March 19, 1997 Environment: VC4.2b, Win95, WinNT 4.0 service pack 2 Hello, I am trying to make a Cmap of Clists by the following code: CListlistData; // This is the definition of the list of defined class CThermoData. CMap componentsData; // This is where I want to make a map with a CString key and listData values. I get the following error code: error C2327: 'CDrawDoc::listData' : member from enclosing class is not a type name, static, or enumerator Does it mean that I have to create a separate class CListData derived from CList, in order to be able to do what I want? Manolis Papadopoulos Laboratory of Metallurgy, NTUA
David Ellis -- dellis@workflowint.com Sunday, March 23, 1997 [Mini-digest: 4 responses] Advanced? MFC? CMap requires TYPES, not variables. Thus: CListlistData; CMap Should Be: typedef CList listData; CMap componentsData; Yours David. ---------- > From: Manolis Papadopoulos > To: 'MFC Mailing List' > Subject: Map of Lists > Date: Wednesday, March 19, 1997 10:00 AM > > Environment: VC4.2b, Win95, WinNT 4.0 service pack 2 > > Hello, > > I am trying to make a Cmap of Clists by the following code: > > CList listData; // This is the definition of the list of defined class CThermoData. > CMap componentsData; // This is where I want to make a map with a CString key and listData values. > > I get the following error code: error C2327: 'CDrawDoc::listData' : member from enclosing class is not a type name, static, or enumerator > > Does it mean that I have to create a separate class CListData derived from CList, in order to be able to do what I want? > > Manolis Papadopoulos > Laboratory of Metallurgy, NTUA > > -----From: "Jason Healy" The class CMap expects class types, what you are provinding as the parameters is an instance of an object (listData). You should be providing CList<...> as parameters. If the code where to compile, what would be the point of a map, to the same single instance of an object. Try the following class CListData : public CList { public: //...... }; CMap Jason jason@hkjcs.oz.au ---------- > Environment: VC4.2b, Win95, WinNT 4.0 service pack 2 > > Hello, > > I am trying to make a Cmap of Clists by the following code: > > CList listData; // This is the definition of > the list of defined class CThermoData. > CMap componentsData; // This is > where I want to make a map with a CString key and listData values. > > I get the following error code: error C2327: 'CDrawDoc::listData' : member > from enclosing class is not a type name, static, or enumerator > > Does it mean that I have to create a separate class CListData derived from > CList, in order to be able to do what I want? > > Manolis Papadopoulos > Laboratory of Metallurgy, NTUA > > -----From: Olivier PLANCHON > CList listData; > // This is the definition of the list of defined class CThermoData. this is the definition of an instance, not a Type. try this (I've not tested at all) : typedef CList My_type_of_listData ; CMap componentsData ; --------------------------------------- Olivier PLANCHON, ORSTOM, BP 1386 Dakar tel(221) 32 34 80 fax (221) 32 43 07 e-mail Olivier.Planchon@orstom.sn -----From: "Michael S. Scherotter" The template parameters to the collection classes must be types, not objects. Try this: typedef CList CThermoDataList; typedef CMap ThermoDataListMap; ThermoDataListMap theListMap; Michael S. Scherotter |Architectural Design Tools Lead Software Developer |AutoCAD Applications Tartus Development, Inc. |Custom CAD Solutions 630 Las Gallinas Ave #300 |__________________________ San Rafael, CA 94903 mailto:mss@tartus.com (415) 491-8925 mailto:michael@charette.com (415) 491-8921 (fax) http://www.tartus.com/people/mss ---------- > From: Manolis Papadopoulos > To: 'MFC Mailing List' > Subject: Map of Lists > Date: Wednesday, March 19, 1997 7:00 AM > > Environment: VC4.2b, Win95, WinNT 4.0 service pack 2 > > Hello, > > I am trying to make a Cmap of Clists by the following code: > > CList listData; // This is the definition of the list of defined class CThermoData. > CMap componentsData; // This is where I want to make a map with a CString key and listData values. > > I get the following error code: error C2327: 'CDrawDoc::listData' : member from enclosing class is not a type name, static, or enumerator
Mark -- MHORD@cerner.com Tuesday, March 25, 1997 I think you're going to kick yourself when you realize this one unless the code you have posted is not actually what is in your program... Here's the problem: CList<....> listData; // instantiates an object named listData CMap<...., listData, listData&> // is not using class names but using an object name. So, I think what you would prefer to do is: /////////// typedef CListThermoDataList; CMap componentsData; //or, without the typedef: // // CMap *, CList *> // but, this is obviously kindof messy and difficult to read. Or something of that sort. I find that pointers and references to pointers typically work best in the long run but you might want to experiment with other techniques. I don't use the MFC templates too often though so I hope somebody else offers an opinion here. Mark J. Mark Hord (Senior Programmer) mhord@cerner.com Cerner Corporation http://www.cerner.com 2800 Rock Creek Pkwy Kansas City, MO 64117-2551 (816)472-1024 x2384 >-----Original Message----- >From: Manolis Papadopoulos [SMTP:papadop@metal.ntua.gr] >Sent: Wednesday, March 19, 1997 9:00 AM >To: 'MFC Mailing List' >Subject: Map of Lists > >Environment: VC4.2b, Win95, WinNT 4.0 service pack 2 > >Hello, > >I am trying to make a Cmap of Clists by the following code: > > CList listData; // This is the definition of the >list of defined class CThermoData. > CMap componentsData; // This is where >I want to make a map with a CString key and listData values. > >I get the following error code: error C2327: 'CDrawDoc::listData' : member >from enclosing class is not a type name, static, or enumerator > >Does it mean that I have to create a separate class CListData derived from >CList, in order to be able to do what I want? > >Manolis Papadopoulos >Laboratory of Metallurgy, NTUA > >
Become an MFC-L member | Вернуться в корень Архива |