Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,673 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,193 people online right now. Registration is fast and FREE... Join Now!




Cannot define mixed types as members?

 
Reply to this topicStart new topic

Cannot define mixed types as members?, wtf, VC++ 2005 is a piece of sh*t

BrainStew
post 5 Sep, 2007 - 12:31 PM
Post #1


D.I.C Head

**
Joined: 2 Aug, 2007
Posts: 149



Thanked 1 times
My Contributions


So I find out you can't define a stl container as a member in a windows form class... fine. So I build my own container, (dynamic stack of string), and try to define that... same error. Which I KNEW I would get... my question is:

Using VC++ (CLI) am I stuck with a plain old array or can I use ANYTHING better?

I'm trying to make an array I can dynamically make bigger/smaller and add/remove more items. I didn't want to simply define a huge array and fill it with crap, but thats what I'm thinking I might have to do. Does this make sense?

thanks if anyone can answer this question.
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 5 Sep, 2007 - 12:50 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,062



Thanked 175 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Well you could add something like a static ArrayList to the form...

CODE

static ArrayList^ blah = gcnew ArrayList();


That will give you the basics of adding and removing like a vector would. ArrayList is part of the System::Collections namespace that is included by default with windows apps in VC++ 2005.

You could use the ArrayList to add primitive types or complex objects. So the flexibility should be there.

Hope this makes up for the bad news that you can't have mixed types. smile.gif
User is offlineProfile CardPM

Go to the top of the page

BrainStew
post 5 Sep, 2007 - 01:51 PM
Post #3


D.I.C Head

**
Joined: 2 Aug, 2007
Posts: 149



Thanked 1 times
My Contributions


awesome, I remember using arraylist in the past, but that was so long ago I forgot about it.

Thanks a lot martyr, you've been a great help.

Cheers.
User is offlineProfile CardPM

Go to the top of the page

musya
post 5 Sep, 2007 - 02:05 PM
Post #4


D.I.C Regular

Group Icon
Joined: 25 Apr, 2007
Posts: 291



Thanked 1 times

Dream Kudos: 50
My Contributions


QUOTE(BrainStew @ 5 Sep, 2007 - 02:51 PM) *

awesome, I remember using arraylist in the past, but that was so long ago I forgot about it.

Thanks a lot martyr, you've been a great help.

Cheers.


Why not just use a linked list?
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 5 Sep, 2007 - 02:12 PM
Post #5


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,062



Thanked 175 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


QUOTE(musya @ 5 Sep, 2007 - 03:05 PM) *

QUOTE(BrainStew @ 5 Sep, 2007 - 02:51 PM) *

awesome, I remember using arraylist in the past, but that was so long ago I forgot about it.

Thanks a lot martyr, you've been a great help.

Cheers.


Why not just use a linked list?


He could use a linked list as well, they are all types of collections and it might be a bit more efficient depending on what he needs it for. However most people find an ArrayList pretty straight forward to work with so unless he needs the extra performance it really doesn't matter since they are essentially used the same way. Good call musya. smile.gif
User is offlineProfile CardPM

Go to the top of the page

BrainStew
post 5 Sep, 2007 - 03:11 PM
Post #6


D.I.C Head

**
Joined: 2 Aug, 2007
Posts: 149



Thanked 1 times
My Contributions


linked lists are ok, but more annoying to use. Good idea none the less, I might use one or the other.
User is offlineProfile CardPM

Go to the top of the page

musya
post 5 Sep, 2007 - 10:36 PM
Post #7


D.I.C Regular

Group Icon
Joined: 25 Apr, 2007
Posts: 291



Thanked 1 times

Dream Kudos: 50
My Contributions


QUOTE(Martyr2 @ 5 Sep, 2007 - 03:12 PM) *

QUOTE(musya @ 5 Sep, 2007 - 03:05 PM) *

QUOTE(BrainStew @ 5 Sep, 2007 - 02:51 PM) *

awesome, I remember using arraylist in the past, but that was so long ago I forgot about it.

Thanks a lot martyr, you've been a great help.

Cheers.


Why not just use a linked list?


He could use a linked list as well, they are all types of collections and it might be a bit more efficient depending on what he needs it for. However most people find an ArrayList pretty straight forward to work with so unless he needs the extra performance it really doesn't matter since they are essentially used the same way. Good call musya. smile.gif



Thanks! wink2.gif Good luck BrainStew in what ever you use
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 06:21AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month