![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
Join Date: Nov 2005
Posts: 149
Rep Power: 4
![]() |
ArrayList and MSDN
I see MSDN has some things on the ArrayList object, but I can't use them in my program. How do I include them in my program? I've tried #include <ArrayList>, but that didn't work...
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
It's for C# (.NET). You will have to do with std::vector or the likes.
P.S. In C# you would do: using System.Collections;
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#3 | |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
I'm pretty sure you can use the .NET libraries in VC++, but I've never actually tried. You might want to look at some of their example codes and see how they do it. Quick snippet from one of their pages:
Quote:
|
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Jimbo, you are right, VC++.NET. Not C++ though.
![]() If I was going to do .NET, I'd definitely use C#.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#5 | |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
Quote:
![]() |
|
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Nov 2005
Posts: 149
Rep Power: 4
![]() |
Is there something I can use like an ArrayList in C++?
An ArrayList is just a list that you can keep adding elements to, and the size will increase as the amount of items in the list increases. |
|
|
|
|
|
#7 |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
You're probably looking for std::vector.
__________________
PFO - My daily dose of technology. |
|
|
|
|
|
#8 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
![]()
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Jimbo's right, and if you're making a .NET application, you probably want to use the System::Collections::ArrayList class as opposed to std::vector so your application can be ported to different languages easily.
As an aside, .NET 2.0 provides the System::Collections::Generics::List class, which is more equivalent to std::vector in that it is a template class which holds one specific type of object, as opposed to the ArrayList, which can contain any object. The difference can be seen as follows: using System;
using System::Collections;
using System::Collections::Generics;
...
ArrayList myArrayList;
myArrayList.Add("foo");
myArrayList.Add(3);
List<Int32> myList;
myList.Add(4);
myList.Add(37);
// prints: foo 3
Console::WriteLine("{0} {1}", (String)myArrayList[0], (Int32)myArrayList[1]);
// prints: 4 37
Console::WriteLine("{0} {1}", myList[0], myList[1]);Disclaimer: not tested, sorry. |
|
|
|
|
|
#10 |
|
Hobbyist Programmer
Join Date: Nov 2005
Posts: 149
Rep Power: 4
![]() |
I'm using C++ though--Isn't that :: operator for some other language?
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|