Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ managed array size

I have this

function(array<Object^>^ a)

How do I know the length of this array? Like C++, the size has to come with the function?

Thanks,

like image 824
SmallChess Avatar asked Apr 14 '11 13:04

SmallChess


People also ask

What is managed array?

Managed Arrays. Introduction. A managed array is a fixed collection of items that you store in the managed heap.

Is there array size () in C++?

array::size() in C++ STL The introduction of array class from C++11 has offered a better alternative for C-style arrays. size() function is used to return the size of the list container or the number of elements in the list container.

Can you change the size of an array in C++?

Once an array has been allocated, there is no built-in mechanism for resizing it in the C++ programming language. Therefore, we can avoid this problem by dynamically generating a new array, copying over the contents, and then deleting the old array.

How do you include an array in C++?

A typical declaration for an array in C++ is: type name [elements]; where type is a valid type (such as int, float ...), name is a valid identifier and the elements field (which is always enclosed in square brackets [] ), specifies the size of the array.


1 Answers

Function in your case:

function(array<Object^>^ a) {
    auto len = a->Length
}
like image 79
voltento Avatar answered Oct 07 '22 15:10

voltento