Muokkaa

Jaa


Platform::Collections::VectorIterator class

Provides a Standard Template Library iterator for objects derived from the Windows Runtime IVector interface.

VectorIterator is a proxy iterator that stores elements of type VectorProxy<T>. However, the proxy object is almost never visible to user code. For more information, see Collections (C++/CX).

Syntax

template <typename T>
class VectorIterator;

Parameters

T
The typename of the VectorIterator template class.

Members

Public Typedefs

Name Description
difference_type A pointer difference (ptrdiff_t).
iterator_category The category of a random access iterator (::std::random_access_iterator_tag).
pointer A pointer to an internal type, Platform::Collections::Details::VectorProxy<T>, that is required for the implementation of VectorIterator.
reference A reference to an internal type, Platform::Collections::Details::VectorProxy<T>, that is required for the implementation of VectorIterator.
value_type The T typename.

Public constructors

Name Description
VectorIterator::VectorIterator Initializes a new instance of the VectorIterator class.

Public operators

Name Description
VectorIterator::operator- Operator Subtracts either a specified number of elements from the current iterator yielding a new iterator, or a specified iterator from the current iterator yielding the number of elements between the iterators.
VectorIterator::operator-- Operator Decrements the current VectorIterator.
VectorIterator::operator!= Operator Indicates whether the current VectorIterator is not equal to a specified VectorIterator.
VectorIterator::operator* Operator Retrieves a reference to the element specified by the current VectorIterator.
VectorIterator::operator[] Retrieves a reference to the element that is a specified displacement from the current VectorIterator.
VectorIterator::operator+ Operator Returns a VectorIterator that references the element at the specified displacement from the specified VectorIterator.
VectorIterator::operator++ Operator Increments the current VectorIterator.
VectorIterator::operator+= Operator Increments the current VectorIterator by the specified displacement.
VectorIterator::operator< Operator Indicates whether the current VectorIterator is less than a specified VectorIterator.
VectorIterator::operator<= Operator Indicates whether the current VectorIterator is less than or equal to a specified VectorIterator.
VectorIterator::operator-= Operator Decrements the current VectorIterator by the specified displacement.
VectorIterator::operator== Operator Indicates whether the current VectorIterator is equal to a specified VectorIterator.
VectorIterator::operator> Operator Indicates whether the current VectorIterator is greater than a specified VectorIterator.
VectorIterator::operator-> Operator Retrieves the address of the element referenced by the current VectorIterator.
VectorIterator::operator>= Operator Indicates whether the current VectorIterator is greater than or equal to a specified VectorIterator.

Inheritance Hierarchy

VectorIterator

Requirements

Header: collection.h

Namespace: Platform::Collections

VectorIterator::operator-> operator

Retrieves the address of the element referenced by the current VectorIterator.

Syntax

Detail::ArrowProxy<T> operator->() const;

Return Value

The value of the element that is referenced by the current VectorIterator.

The type of the return value is an unspecified internal type that is required for the implementation of this operator.

VectorIterator::operator-- operator

Decrements the current VectorIterator.

Syntax

VectorIterator& operator--();
VectorIterator operator--(int);

Return Value

The first syntax decrements and then returns the current VectorIterator. The second syntax returns a copy of the current VectorIterator and then decrements the current VectorIterator.

Remarks

The first VectorIterator syntax pre-decrements the current VectorIterator.

The second syntax post-decrements the current VectorIterator. The int type in the second syntax indicates a post-decrement operation, not an actual integer operand.

VectorIterator::operator* operator

Retrieves the address of the element specified by the current VectorIterator.

Syntax

reference operator*() const;

Return Value

The element specified by the current VectorIterator.

VectorIterator::operator== operator

Indicates whether the current VectorIterator is equal to a specified VectorIterator.

Syntax

bool operator==(const VectorIterator& other) const;

Parameters

other
Another VectorIterator.

Return Value

true if the current VectorIterator is equal to other; otherwise, false.

VectorIterator::operator> operator

Indicates whether the current VectorIterator is greater than a specified VectorIterator.

Syntax

bool operator>(const VectorIterator& other) const

Parameters

other
Another VectorIterator.

Return Value

true if the current VectorIterator is greater than other; otherwise, false.

VectorIterator::operator>= operator

Indicates whether the current VectorIterator is greater than or equal to the specified VectorIterator.

Syntax

bool operator>=(const VectorIterator& other) const

Parameters

other
Another VectorIterator.

Return Value

true if the current VectorIterator is greater than or equal to other; otherwise, false.

VectorIterator::operator++ operator

Increments the current VectorIterator.

Syntax

VectorIterator& operator++();
VectorIterator operator++(int);

Return Value

The first syntax increments and then returns the current VectorIterator. The second syntax returns a copy of the current VectorIterator and then increments the current VectorIterator.

Remarks

The first VectorIterator syntax pre-increments the current VectorIterator.

The second syntax post-increments the current VectorIterator. The int type in the second syntax indicates a post-increment operation, not an actual integer operand.

VectorIterator::operator!= operator

Indicates whether the current VectorIterator is not equal to a specified VectorIterator.

Syntax

bool operator!=(const VectorIterator& other) const;

Parameters

other
Another VectorIterator.

Return Value

true if the current VectorIterator is not equal to other; otherwise, false.

VectorIterator::operator< operator

Indicates whether the current VectorIterator is less than a specified VectorIterator.

Syntax

bool operator<(const VectorIterator& other) const

Parameters

other
Another VectorIterator.

Return Value

true if the current VectorIterator is less than other; otherwise, false.

VectorIterator::operator<= operator

Indicates whether the current VectorIterator is less than or equal to a specified VectorIterator.

Syntax

bool operator<=(const VectorIterator& other) const

Parameters

other
Another VectorIterator.

Return Value

true if the current VectorIterator is less than or equal to other; otherwise, false.

VectorIterator::operator- operator

Subtracts either a specified number of elements from the current iterator yielding a new iterator, or a specified iterator from the current iterator yielding the number of elements between the iterators.

Syntax

VectorIterator operator-(difference_type n) const;

difference_type operator-(const VectorIterator& other) const;

Parameters

n
A number of elements.

other
Another VectorIterator.

Return Value

The first operator syntax returns a VectorIterator object that is n elements less than the current VectorIterator. The second operator syntax returns the number of elements between the current and the other VectorIterator.

VectorIterator::operator+= operator

Increments the current VectorIterator by the specified displacement.

Syntax

VectorIterator& operator+=(difference_type n);

Parameters

n
A integer displacement.

Return Value

The updated VectorIterator.

VectorIterator::operator+ operator

Returns a VectorIterator that references the element at the specified displacement from the specified VectorIterator.

Syntax

VectorIterator operator+(difference_type n);

template <typename T>
inline VectorIterator<T> operator+(
  ptrdiff_t n,
  const VectorIterator<T>& i);

Parameters

T
In the second syntax, the typename of the VectorIterator.

n
An integer displacement.

i
In the second syntax, a VectorIterator.

Return Value

In the first syntax, a VectorIterator that references the element at the specified displacement from the current VectorIterator.

In the second syntax, a VectorIterator that references the element at the specified displacement from the beginning of parameter i.

Remarks

The first syntax example

VectorIterator::operator-= operator

Decrements the current VectorIterator by the specified displacement.

Syntax

VectorIterator& operator-=(difference_type n);

Parameters

n
An integer displacement.

Return Value

The updated VectorIterator.

VectorIterator::operator[] operator

Retrieves a reference to the element that is a specified displacement from the current VectorIterator.

Syntax

reference operator[](difference_type n) const;

Parameters

n
An integer displacement.

Return Value

The element that is displaced by n elements from the current VectorIterator.

VectorIterator::VectorIterator constructor

Initializes a new instance of the VectorIterator class.

Syntax

VectorIterator();

explicit VectorIterator(
   Windows::Foundation::Collections::IVector<T>^ v);

Parameters

v
An IVector<T> object.

Remarks

The first syntax example is the default constructor. The second syntax example is an explicit constructor that is used to construct a VectorIterator from an IVector<T> object.

See also

Platform Namespace