Platform::ArrayReference Class

ArrayReference is an optimization type that you can substitute for Platform::Array^ in input parameters when you want to fill a C-style array with the input data.

Syntax

class ArrayReference

Members

Public Constructors

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

Public Operators

Name Description
ArrayReference::operator() Operator Converts this ArrayReference to a Platform::Array<T>^*.
ArrayReference::operator= Operator Assigns the contents of another ArrayReference to this instance.

Exceptions

Remarks

By using ArrayReference to fill a C-style array, you avoid the extra copy operation that would be involved in copying first to a Platform::Array variable, and then into the C-style array. When you use ArrayReference, there is only one copy operation. For a code example, see Array and WriteOnlyArray.

Requirements

Minimum supported client: Windows 8

Minimum supported server: Windows Server 2012

Namespace: Platform

Header: vccorlib.h

ArrayReference::ArrayReference Constructor

Initializes a new instance of the Platform::ArrayReference class.

Syntax

ArrayReference(TArg* ataArg, unsigned int sizeArg, bool needsInitArg = false);
ArrayReference(ArrayReference&& otherArg)

Parameters

dataArg
A pointer to the array data.

sizeArg
The number of elements in the source array.

otherArg
An ArrayReference object whose data will be moved to initialize the new instance.

Remarks

ArrayReference::operator= Operator

Assigns the specified object to the current Platform::ArrayReference object by using move semantics.

Syntax

ArrayReference& operator=(ArrayReference&& otherArg);

Parameters

otherArg
The object that is moved to the current ArrayReference object.

Return Value

A reference to an object of type ArrayReference.

Remarks

Platform::ArrayReference is a standard C++ class template, not a ref class.

ArrayReference::operator() Operator

Converts the current Platform::ArrayReference object back to a Platform::Array class.

Syntax

Array<TArg>^ operator ();

Return Value

A handle-to-object of type Array<TArg>^

Remarks

Platform::ArrayReference is a standard C++ class template, and Platform::Array is a ref class.

See also

Platform namespace