A view, or span, of a contiguous series of values. For more examples and info about winrt::array_view, see Standard C++ data types and C++/WinRT.
Syntaxtemplate <typename T>
struct array_view
Template parameters
typename T
The type of the values (elements) that the array_view views, or spans.
Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)
Namespace: winrt
Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)
Member type aliases Alias name Type array_view::value_type A synonym for thetypename T
template parameter. array_view::size_type A synonym for uint32_t. array_view::reference A synonym for array_view::value_type&. array_view::const_reference A synonym for array_view::value_type const&. array_view::pointer A synonym for array_view::value_type*. array_view::const_pointer A synonym for array_view::value_type const*. array_view::iterator A synonym for an implementation-defined array iterator of array_view::value_type. array_view::const_iterator A synonym for an implementation-defined array iterator of array_view::value_type const. array_view::reverse_iterator A synonym for std::reverse_iterator<array_view::iterator>. array_view::const_reverse_iterator A synonym for std::reverse_iterator<array_view::const_iterator>. Constructors Member functions Member operators Free operators Iterators
An array_view is a range, and that range is defined by the array_view::begin and array_view::end member functions, each of which returns an iterator (also see array_view::cbegin and array_view::cend). Because of this, you can enumerate the characters in an array_view object with either a range-based for
statement, or with the std::for_each template function.
#include <iostream>
using namespace winrt;
...
template <typename T>
void Iterators(array_view<T> const& theArrayView)
{
for (T& element : theArrayView)
{
std::wcout << element << " ";
}
std::for_each(theArrayView.cbegin(), theArrayView.cend(), [](T const& element) { std::wcout << element << " "; });
}
array_view::array_view constructor
Initializes a new instance of the array_view struct as a view over (and not a copy of) the input data.
Syntaxarray_view() noexcept;
template <typename C, uint32_t N> array_view(C(&rawArrayValue)[N]) noexcept;
template <typename C, uint32_t N> array_view(std::array<C, N> const& arrayValue) noexcept;
template <typename C, uint32_t N> array_view(std::array<C, N>& arrayValue) noexcept;
array_view(std::initializer_list<T> initializerListValue) noexcept;
template <typename C> array_view(std::vector<C> const& vectorValue) noexcept;
template <typename C> array_view(std::vector<C>& vectorValue) noexcept;
array_view(T* first, T* last) noexcept;
Template parameters
typename C
The type of the values (elements) in the input data.
uint32_t N
The number of values (elements) in the input data.
rawArrayValue
A raw array value that initializes the array_view object.
arrayValue
A std::array value that initializes the array_view object.
initializerListValue
An initializer list value that initializes the array_view object.
vectorValue
A std::vector value that initializes the array_view object.
first
last
Pointers to values with which to initialize the array_view object. If first
equals last
, then the array_view object is empty.
using namespace winrt;
...
void Constructors()
{
// array_view() noexcept
array_view<byte const> fromDefault{};
byte theRawArray[]{ 99, 98, 97 };
// template <typename C, uint32_t N> array_view(C(&value)[N]) noexcept
array_view<byte const> fromRawArray{ theRawArray };
const std::array<byte, 3> theConstArray{ 99, 98, 97 };
// template <typename C, uint32_t N> array_view(std::array<C, N>& value) noexcept
array_view<byte const> fromConstArray{ theConstArray };
std::array<byte, 3> theArray{ 99, 98, 97 };
// template <typename C, uint32_t N> array_view(std::array<C, N> const& value) noexcept
array_view<byte const> fromArray{ theArray };
// array_view(std::initializer_list<T> value) noexcept
array_view<byte const> fromInitializerList{ 99, 98, 97 };
const std::vector<byte> theConstVector{ 99, 98, 97 };
// template <typename C> array_view(std::vector<C> const& value) noexcept
array_view<byte const> fromConstVector{ theConstVector };
std::vector<byte> theVector{ 99, 98, 97 };
// template <typename C> array_view(std::vector<C>& value) noexcept
array_view<byte const> fromVector{ theVector };
// array_view(T* first, T* last) noexcept
array_view<byte const> fromRange{ theArray.data(), theArray.data() + 2 }; // just the first two elements.
}
array_view::at function
Returns a reference to the element at the specified position within the array_view object.
SyntaxT& at(uint32_t const pos);
T const& at(uint32_t const pos) const;
Parameters
pos
A zero-based element position, or index.
A reference to the element at the specified position within the array_view object.
array_view::back functionReturns a reference to the last element in the array_view object.
SyntaxT const& back() const noexcept;
T& back() noexcept;
Return value
A reference to the last element in the array_view object.
array_view::begin functionReturns an iterator to the first element in the array_view object. See Iterators.
Syntaxstdext::checked_array_iterator<T const> begin() const noexcept;
stdext::checked_array_iterator<T> begin() noexcept;
Return value
An iterator to the first element in the array_view object.
array_view::cbegin functionReturns a const iterator to the first element in the array_view object. See Iterators.
Syntaxstdext::checked_array_iterator<T const> cbegin() const noexcept;
Return value
A const iterator to the first element in the array_view object.
array_view::cend functionReturns a const iterator to one beyond the end of (one beyond the last element in) the array_view object. See Iterators.
Syntaxstdext::checked_array_iterator<T const> cend() const noexcept;
Return value
A const iterator to one beyond the end of (one beyond the last element in) the array_view object.
array_view::crbegin functionReturns a const reverse iterator to one beyond the end of (one beyond the last element in) the array_view object.
Syntaxstd::reverse_iterator<stdext::checked_array_iterator<T const>> crbegin() const noexcept;
Return value
A const reverse iterator to one beyond the end of (one beyond the last element in) the array_view object.
array_view::crend functionReturns a const reverse iterator to the first element in the array_view object.
Syntaxstd::reverse_iterator<stdext::checked_array_iterator<T const>> crend() const noexcept;
Return value
A const reverse iterator to the first element in the array_view object.
array_view::data functionReturns a pointer to the underlying data being viewed by the array_view object.
SyntaxT const* data() const noexcept;
T* data() noexcept;
Return value
A pointer to the underlying data being viewed by the array_view object.
array_view::empty functionReturns a value indicating whether the array_view object is empty (is a view on zero elements).
Syntaxbool empty() const noexcept;
Return value
true
if the array_view object is empty (is a view on zero elements), otherwise false
.
Returns an iterator to one beyond the end of (one beyond the last element in) the array_view object. See Iterators.
Syntaxstdext::checked_array_iterator<T const> end() const noexcept;
stdext::checked_array_iterator<T> end() noexcept;
Return value
An iterator to one beyond the end of (one beyond the last element in) the array_view object.
array_view::front functionReturns a reference to the first element in the array_view object.
SyntaxT const& front() const noexcept;
T& front() noexcept;
Return value
A reference to the first element in the array_view object.
array_view::operator[] (subscript operator)Returns a reference to the element at the specified position within the array_view object.
SyntaxT const& operator[](uint32_t const pos) const noexcept;
T& operator[](uint32_t const pos) noexcept;
Parameters
pos
A zero-based element position, or index.
A reference to the element at the specified position within the array_view object.
array_view::rbegin functionReturns a reverse iterator to one beyond the end of (one beyond the last element in) the array_view object.
Syntaxstd::reverse_iterator<stdext::checked_array_iterator<T const>> rbegin() const noexcept;
std::reverse_iterator<stdext::checked_array_iterator<T>> rbegin() noexcept;
Return value
A reverse iterator to one beyond the end of (one beyond the last element in) the array_view object.
array_view::rend functionReturns a reverse iterator to the first element in the array_view object.
Syntaxstd::reverse_iterator<stdext::checked_array_iterator<T const>> rend() const noexcept;
std::reverse_iterator<stdext::checked_array_iterator<T>> rend() noexcept;
Return value
A reverse iterator to the first element in the array_view object.
array_view::size functionReturns the number of elements in the array_view object.
Syntaxuint32_t size() const noexcept;
Return value
A uint32_t
containing the number of elements in the array_view object.
Returns a value indicating whether the two parameters are unequal to one another.
Syntaxtemplate <typename T> bool operator!=(winrt::array_view<T> const& left, winrt::array_view<T> const& right) noexcept;
Parameters
left
right
An array_view value to compare with the other parameter.
true
if the two parameters are unequal to one another, otherwise false
.
Returns a value indicating whether the first parameter is less than the second parameter.
Syntaxtemplate <typename T> bool operator<(winrt::array_view<T> const& left, winrt::array_view<T> const& right) noexcept;
Parameters
left
right
An array_view value to compare with the other parameter.
true
if the first parameter is less than the second parameter, otherwise false
.
Returns a value indicating whether the first parameter is less than or equal to the second parameter.
Syntaxtemplate <typename T> bool operator<=(winrt::array_view<T> const& left, winrt::array_view<T> const& right) noexcept;
Parameters
left
right
An array_view value to compare with the other parameter.
true
if the first parameter is less than or equal to the second parameter, otherwise false
.
Returns a value indicating whether the two parameters are equal to one another.
Syntaxtemplate <typename T> bool operator==(winrt::array_view<T> const& left, winrt::array_view<T> const& right) noexcept;
Parameters
left
right
An array_view value to compare with the other parameter.
true
if the two parameters are equal to one another, otherwise false
.
Returns a value indicating whether the first parameter is greater than the second parameter.
Syntaxtemplate <typename T> bool operator>(winrt::array_view<T> const& left, winrt::array_view<T> const& right) noexcept;
Parameters
left
right
An array_view value to compare with the other parameter.
true
if the first parameter is greater than the second parameter, otherwise false
.
Returns a value indicating whether the first parameter is greater than or equal to the second parameter.
Syntaxtemplate <typename T> bool operator>=(winrt::array_view<T> const& left, winrt::array_view<T> const& right) noexcept;
Parameters
left
right
An array_view value to compare with the other parameter.
true
if the first parameter is greater than or equal to the second parameter, otherwise false
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4