serialize a CUIntArray?

Hi all,
I am trying to serialize a CUIntArray, but as far as I can see, CUIntArray.Serialize() is not implemented and so CObject.Serialize() is called.
I also tried to override :
CArchive& operator<<( CArchive& ar, const CUIntArray arrUint );
CArchive& operator>>( CArchive& ar, CUIntArray arrUint );
but then I get a
"binary '<<' : no operator defined which takes a left-hand operand of type 'class CArchive' (or there is no acceptable conversion)" errors on compile.
so,
1. Is there a proper way to serialize a non-template array?
2. Is there a reason why CUIntArray.Serialize is not implemented?
3. Is my "operator<<(...)" syntax incorrect?
4. Any other ideas?

thanxs in advance,
        Dagan
daganAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PIGCommented:
Inherit CUIntArray.
class CYurUIntArray : public CUIntArray{
......
public:
  DELARE_SERIAL(CUIntArray)
  void Serialize(CArchive& pAch);
....
}


CArchive& operator >>( CArchive& ar, CYurUIntArray *& pOb );
CArchive& operator <<( CArchive& ar, CYurUIntArray *& pOb );

In source
IMPLEMENT_SERIAL(CYurUIntArray, CObject, 1)
.....

It must be work.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
daganAuthor Commented:
hi pig,
Eventually I believe that this is what I'll do... meanwhile you'll excuse me for not giving you the points since I wanna give others the chance to answer THE OTHER QUESTIONS.
I promise that if I won't get better answers, you'll be rewarded for yours.
It's just that it seems a little weird that there's no pretty solution built in.
0
PIGCommented:
OK.
void CYurUIntArray::Serialize(CArchive& ar){
 ASSERT_VALID(this);

 CObject::Serialize(ar);

 if (ar.IsStoring()){
   ar.WriteCount(m_nSize);
   for (int i = 0; i < m_nSize; i++)
     ar << m_pData[i];
 }else{
  DWORD nOldSize = ar.ReadCount();
  SetSize(nOldSize);
  for (int i = 0; i < m_nSize; i++)
    ar >> m_pData[i];
 }
}
That can be sufficient for You.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.