Solved

CArray of CStringArray

Posted on 2002-06-12
4
955 Views
Last Modified: 2013-11-20
Hi all!

Got a little problem, my CArray is declared like that:

CArray< CStringArray , CStringArray& > cZoneArray;

And i try to fill it like that:

        CStringArray tempArray;
        CString tempString;

        //Numéro de la zone
        tempArray.Add( "1" );

        //Prendre le minScan
        m_EditMinScanDiam.GetWindowText( tempString );
        tempArray.Add( tempString );

        //Prendre le maxScan
        m_EditMaxScanDiam.GetWindowText( tempString );
        tempArray.Add( tempString );

        cZoneArray.Add( tempArray );

But I get this puzzling error:

d:\...\afxtempl.h(443) : error C2582: 'CStringArray' : 'operator =' function is unavailable
d:\...\afxtempl.h(1566) : while compiling class-template member function 'void __thiscall CArray<class CStringArray,class CStringArray &>::SetAtGrow(int,class CStringArray &)'


What am i doing wrong here?

Thanks!

Moonover
0
Comment
Question by:David MacDonald
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 7073259
>>What am i doing wrong here?

'CStringArray' doesn't have an 'operator=()', as the compiler is mentioning, so that won't work. There are two options:

- derive your own class from 'CStringArray' and add the operator
- store pointers to 'CStringArray' in the CArray, not instances
0
 
LVL 1

Author Comment

by:David MacDonald
ID: 7073341
Ok, if I store pointers to StringArrays and after that serialize the CArray that contains the pointers,
will the data be serialized or only the addresses of my StringArrays?
0
 
LVL 86

Expert Comment

by:jkr
ID: 7073360
That's a good question - it depends on how you implement that.
0
 
LVL 1

Author Comment

by:David MacDonald
ID: 7073366
Ok, that's a good start, i'll serialize it manually, it won't be too messy...

Thanks a lot jkr!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now