Platform::Collections::Vector Class

Platform::Collections::Vector Class


Represents a sequential collection of objects that can be individually accessed by index.

template <typename T, typename E>
   ref class Vector sealed;


The type of the elements contained in the Vector object.


Specifies a binary predicate for testing equality with values of type T. The default value is std::equal_to<T>.

Allowed types are:

  1. integers

  2. interface class ^

  3. public ref class^

  4. value struct

  5. public enum class

The Vector class is the C++ concrete implementation of the Windows::Foundation::Collections::IVector interface.

If you attempt to use a Vector type in a public return value or parameter, compiler error C3986 will be raised. You can fix the error by changing the parameter or return value type to Windows::Foundation::Collections::IVector. For more information, see Collections (C++/CX).

Public Constructors



Vector::Vector Constructor

Initializes a new instance of the Vector class.

Public Methods



Vector::Append Method

Inserts the specified item after the last item in the current Vector.

Vector::Clear Method

Deletes all the elements in the current Vector.

Vector::First Method

Returns an iterator that specifies the first element in the Vector.

Vector::GetAt Method

Retrieves the element of the current Vector that is identifed by the specified index.

Vector::GetMany Method

Retrieves a sequence of items from the current Vector, starting at the specified index.

Vector::GetView Method

Returns a read-only view of a Vector; that is, a Platform::Collections::VectorView.

Vector::IndexOf Method

Searches for the specified item in the current Vector, and if found, returns the index of the item.

Vector::InsertAt Method

Inserts the specified item into the current Vector after the element identified by the specified index.

Vector::ReplaceAll Method

Deletes the elements in the current Vector and then inserts the elements from the specified array.

Vector::RemoveAt Method

Deletes the element identified by the specified index from the current Vector.

Vector::RemoveAtEnd Method

Deletes the element at the end of the current Vector.

Vector::SetAt Method

Assigns the specified value to the element in the current Vector that is identified by the specified index.

Vector::Size Method

Returns the number of elements in the current Vector object.




event Windows::Foundation::Collection::VectorChangedEventHandler<T>^ VectorChanged

Occurs when the Vector changes.


Header: collection.h

Namespace: Platform::Collections

© 2017 Microsoft