winrt::single_threaded_vector function template (C++/WinRT)

A function template that creates and returns an object of a type that implements a general-purpose (but not observable) collection. The object is returned as an IVector, and that's the interface via which you call the returned object's functions and properties.

You can optionally pass an existing std::vector rvalue into the function—either pass a temporary object, or call std::move on an lvalue.

For more info, and code examples, see Collections with C++/WinRT.


template <typename T, typename Allocator = std::allocator<T>>
winrt::Windows::Foundation::Collections::IVector<T> single_threaded_vector(std::vector<T, Allocator>&& values = {});

Template parameters

typename T The type of the elements of the collection.

typename Allocator The type of the allocator of the vector from which you initialize the collection, if you pass one, otherwise the default allocator.


values An optional reference to an rvalue of type std::vector from which to initialize the elements of the collection object.

Return value

An IVector representing a new collection object.


Minimum supported SDK: Windows SDK version 10.0.17763.0 (Windows 10, version 1809)

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)

See also