[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    QMemarray issue
From:       ian reinhart geiser <geiseri () yahoo ! com>
Date:       2002-02-14 19:18:12
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings
	Okay this is pushing my knowledge of C++ so I am at the end of my rope.

I have a datastructure that is holding a QMemarray of a bunch of items.  These 
are all of different types all based off of the same base class.  All of 
these classes have copy constructors, but my issue comes while copying the 
array.  It seems that QMemearray has only a shallow copy, so I need to make a 
deep copy myself.  The issue I have is that when I make a deep copy it 
converts all of the elements in the array to the base class.  This is a 
problem.  I cannot seem to find in any of my books how to get the correct 
copy constructor to be called. Currently I have something like this:
	list.clear();
	for(int idx=0; idx < obj.list.count(); idx++)
	{
		list.append(new InterfaceObject(*(obj.list.at(idx)), 	
		obj.list.at(idx)->getName(), this));
	}

Interface object is my baseclass, and I know this code is wrong, my question 
is what is the correct way to call each element in the lists own copy 
constructor so I can make a deep copy of the list?  Or is there a better way?

Also I used Qmemarray because I was told it was faster than QPtrList, would 
another data structure make this easier?

Thanks
	-ian reinhart geiser
- -- 
:-- Ian Reinhart Geiser --:
GPG Key: D6A6 7E16 13A9 B5A7 9E18 D1A7 3F2E B64D 19BC 76F8
===========================================================
===========================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8bA10Py62TRm8dvgRAvAXAKCbw8IcRvGm2oMY7f0wkxv48NH6GQCfWPvL
0wqLWhxVW1Vi6RaeFmxxcDM=
=XtjQ
-----END PGP SIGNATURE-----


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic