xtd 0.2.0
read_only_span.hpp File Reference
#include "internal/__xtd_std_version.hpp"
#include "collections/generic/helpers/wrap_pointer_iterator.hpp"
#include "argument_null_exception.hpp"
#include "argument_out_of_range_exception.hpp"
#include "array.hpp"
#include "dynamic_extent.hpp"
#include "iequatable.hpp"
#include "index_out_of_range_exception.hpp"
#include "is.hpp"
#include "null.hpp"
#include "object.hpp"
#include "ptrdiff.hpp"
#include "ranges.hpp"
#include "span.hpp"
#include "typeof.hpp"
#include <type_traits>
#include <vector>

Definition

Contains xtd::read_only_span class.

Go to the source code of this file.

Namespaces

namespace  xtd
 The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
 

Variables

template<class type_t, xtd::size extent>
const read_only_span< type_t, extent > read_only_span< type_t, extent >::empty_read_only_span
 

Public Properties

const_reference xtd::back () const
 Gets the last element.
 
const_iterator xtd::begin () const
 Returns an iterator to the beginning.
 
const_iterator xtd::cbegin () const
 Returns an iterator to the beginning.
 
const_iterator xtd::cend () const
 Returns an iterator to the end.
 
const_reverse_iterator xtd::crbegin () const
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator xtd::crend () const
 Returns a reverse iterator to the end.
 
constexpr const_pointer xtd::data () const noexcept
 Gets direct access to the underlying contiguous storage.
 
constexpr bool xtd::empty () const noexcept
 Returns a value that indicates whether the current xtd::read_only_span <type_t> is empty.
 
const_iterator xtd::end () const
 Returns an iterator to the end.
 
const_reference xtd::front () const
 Gets the first element.
 
constexpr bool xtd::is_empty () const noexcept
 Returns a value that indicates whether the current xtd::read_only_span <type_t> is empty.
 
constexpr size_type xtd::length () const noexcept
 Returns the length of the current read_only_span.
 
const_reverse_iterator xtd::rbegin () const
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator xtd::rend () const
 Returns a reverse iterator to the end.
 
constexpr size_type xtd::size_bytes () const noexcept
 Returns the size of the sequence in bytes.
 

Public Constructors

Creates an empty xtd::read_only_span whose xtd::read_only_span::data is null and xtd::read_only_span::size is 0. template <xtd::size count = 0> constexpr read_only_span() : data_ {xtd::null}, length_ {0} {}

/

/ /

/

/ Creates an xtd::read_only_span with specified iterators. /

Parameters
firstThe iterator to the first element of the sequence. /
lastThe iterator to the last element of the sequence. template<class iterator_t> constexpr read_only_span(iterator_t first, iterator_t last) : data_ { & (first)}, length_ {extent != dynamic_extent ? extent : static_cast<size_type>(std::distance(first, last))} {} / Conflict with read_only_span(collection_t& items, xtd::size count) / Creates an xtd::read_only_span with specified iterator and count. /
firstThe iterator to the first element of the sequence. /
countThe number of elements in the iteration. template<class iterator_t> read_only_span(iterator_t first, xtd::size count) : data_ {&(*first)}, length_ {extent != dynamic_extent ? extent : count} {}
template<xtd::size len>
constexpr xtd::read_only_span (const element_type(&array)[len]) noexcept
 Creates an xtd::read_only_span with specified native array.
 
template<class array_type_t, xtd::size len>
constexpr xtd::read_only_span (const std::array< array_type_t, len > &array) noexcept
 Creates an xtd::read_only_span with specified std::array.
 
template<class range_t>
constexpr xtd::read_only_span (range_t &&range) noexcept
 Creates an xtd::read_only_span with specified range.
 
constexpr xtd::read_only_span (std::initializer_list< type_t > items) noexcept
 Creates an xtd::read_only_span with specified initializer list.
 
template<class collection_t>
constexpr xtd::read_only_span (const collection_t &items, size_type length)
 Creates an xtd::read_only_span with specified collection and count.
 
template<class collection_t>
constexpr xtd::read_only_span (const collection_t &items, size_type start, size_type length)
 Creates an xtd::read_only_span with specified collection, offest and count.
 
constexpr xtd::read_only_span (const type_t *data, size_type length)
 Creates an xtd::read_only_span with specified data pointer and count.
 

Public Methods

const_reference xtd::at (size_type pos) const
 Gets the specified element with bounds checking.
 
template<xtd::size length>
void xtd::copy_to (span< type_t, length > &destination) const
 Copies the contents of this xtd::read_only_span <type_t> into a destination xtd:span <type_t>.
 
bool xtd::equals (const object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool xtd::equals (const read_only_span &rhs) const noexcept override
 Indicates whether the current object is equal to another object of the same type.
 
template<xtd::size count>
read_only_span< type_t, count > xtd::first () const
 Obtains a subspan consisting of the first count elements of the sequence.
 
read_only_span< type_t > xtd::first (xtd::size count) const
 Obtains a subspan consisting of the first count elements of the sequence.
 
xtd::size xtd::get_hash_code () const noexcept override
 Serves as a hash function for a particular type.
 
template<xtd::size count>
read_only_span< type_t, count > xtd::last () const
 Obtains a subspan consisting of the last N elements of the sequence.
 
read_only_span< type_t > xtd::last (xtd::size count) const
 Obtains a subspan consisting of the last N elements of the sequence.
 
template<xtd::size start, size_type lenght = xtd::dynamic_extent>
read_only_span< type_t > xtd::slice () const
 Forms a slice out of the current read_only_span starting at a specified index for a specified length.
 
read_only_span< type_t > xtd::slice (size_type start) const
 Forms a slice out of the current read_only_span that begins at a specified index.
 
read_only_span< type_t > xtd::slice (size_type start, size_type length) const
 Forms a slice out of the current read_only_span starting at a specified index for a specified length.
 
template<xtd::size offset, size_type count = xtd::dynamic_extent>
read_only_span< type_t > xtd::subspan () const
 Forms a subspan of the current read_only_span starting at a specified index for a specified length.
 
read_only_span< type_t > xtd::subspan (size_type offset, size_type count=xtd::dynamic_extent) const
 Forms a subspan of the current read_only_span starting at a specified index for a specified length.
 
xtd::array< std::remove_cv_t< type_t > > xtd::to_array () const noexcept
 Copies the contents of this read_only_span into a new array.
 
string xtd::to_string () const noexcept override
 Returns the string representation of this xtd::read_only_span <type_t> object.
 
template<xtd::size length>
bool xtd::try_copy_to (span< type_t, length > &destination) const noexcept
 Attempts to copy the current xtd::read_only_span <type_t> to a destination xtd::read_only_span <type_t> and returns a value that indicates whether the copy operation succeeded.
 

Public Operators

const_reference xtd::operator[] (size_type index) const
 Gets the element at the specified zero-based index.
 

Native types

using xtd::size
 Represents a size of any object in bytes.