Solved

CArray of CStringArray

Posted on 2002-06-12
4
959 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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 …
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.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

815 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

12 Experts available now in Live!

Get 1:1 Help Now