473,320 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dynamic Arrays in C++\CLI

How do you use a dynamic array or equivalent in C++\CLI?

When using CArray in MFC its simple you say array.Add( item )
If the size needs to grow it will do that for you.

Iv tried using array<item> but understand its dimensions cannot be
changed once created.
This is very restrictive for me.

Ultimately i will be using STL\CLR but this has not been released yet
and am just trying to use a suitable substitute until its released.

Thanks in advance.

Dec 1 '05 #1
6 12669
You can use the ArrayList BCL class.

--
Regards,
Nish [VC++ MVP]
"Herby" <pr********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
How do you use a dynamic array or equivalent in C++\CLI?

When using CArray in MFC its simple you say array.Add( item )
If the size needs to grow it will do that for you.

Iv tried using array<item> but understand its dimensions cannot be
changed once created.
This is very restrictive for me.

Ultimately i will be using STL\CLR but this has not been released yet
and am just trying to use a suitable substitute until its released.

Thanks in advance.

Dec 1 '05 #2
Herby wrote:
How do you use a dynamic array or equivalent in C++\CLI?

When using CArray in MFC its simple you say array.Add( item )
If the size needs to grow it will do that for you.

Iv tried using array<item> but understand its dimensions cannot be
changed once created.
This is very restrictive for me.

Ultimately i will be using STL\CLR but this has not been released yet
and am just trying to use a suitable substitute until its released.


See System::Collections::Generic::List<T>. It's basically an expandable
array.

-cd
Dec 1 '05 #3
Nishant Sivakumar wrote:
You can use the ArrayList BCL class.


But don't do that - it's not typesafe. Use List<T> instead.

-cd
Dec 1 '05 #4
This is still an array? not a linked list?
having O(1) when accessing an item?

Dec 1 '05 #5
Cheers.

List<T> works as i would want it to.

Can anyone confirm that STL\CLR containers will be marked
[Serializable]?
If not how would i serialize potentially 1000's of items contained
within?

Dec 1 '05 #6
JAL
Herby.. Don't forget ArrayList

Collections::ArrayList^ aStrings= gcnew Collections::ArrayList();
aStrings->Add("Managed");
aStrings->Add("Code");
for each (String^ s in aStrings) {
Console::WriteLine(s);
}

"Herby" wrote:
How do you use a dynamic array or equivalent in C++\CLI?

When using CArray in MFC its simple you say array.Add( item )
If the size needs to grow it will do that for you.

Iv tried using array<item> but understand its dimensions cannot be
changed once created.
This is very restrictive for me.

Ultimately i will be using STL\CLR but this has not been released yet
and am just trying to use a suitable substitute until its released.

Thanks in advance.

Dec 2 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select...
2
by: Dominik Stadler | last post by:
Hi, We are trying to migrate an application from Oracle to DB2. In Oracle we used some functionality to attach a dynamic SQL - connection to the static SQL Connection in order to perform SQL in...
4
by: Michel Esber | last post by:
Hello, Environment: db2 V8 FP 13 LUW Our application currently uses: insert into table values ('A'),('B'),...('Z') We have used CLI arrays inserts (1000 array and commit size) and...
24
by: 73blazer | last post by:
So a friend an I inadvertanly came across this problem while diagnosing another: I have a table: create table test.test (g_id int not null, g_width int, g_height int); create index testtest on...
2
by: delta5 | last post by:
hello this is probably a noobish question about an issue i'm having with dynamic arrays. Please take a look at the following snippet of c++/cli code: I would like that the output will be 0 1 2 3 4...
11
by: memeticvirus | last post by:
I have an array cli::array<float, 2and I would like to access a subset of it's values by compiling an array of pointers. But, it's not possible to create an array of type...
1
by: lia.leon | last post by:
Can anyone give me a simple example to demonstrate the captioned question? Actually, instead of PInvoke, we'd like to utilize the united .Net platform to support our requirement:- VB.Net sends...
4
by: rahxephon | last post by:
I am new to CLI/c++ and have some question on the 2 type of array stated above. I am doing some numerical calculation on large number of sample and face some problem with the speed on accessing the...
0
by: Alexander Morou | last post by:
Greetings, I've been writing a framework for the Common Language Infrastructure (aka .NET) for about six to eight months. Its end goal is to greatly reduce the amount of work necessary to write a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.