Represents a fixed array class.
Public Aliases | |
| using | value_type |
| Represents the array value type. | |
| using | base_type |
| Represents the array base type. | |
| using | const_base_type |
| Represents the const array base type. | |
| using | reference |
| Represents the reference of array value type. | |
| using | const_reference |
| Represents the const reference of array value type. | |
| using | pointer |
| Represents the pointer of array value type. | |
| using | const_pointer |
| Represents the const pointer of array value type. | |
| using | size_type |
| Represents the array size type (usually xtd::usize). | |
| using | difference_type |
| Represents the array difference type (usually xtd::ptrdiff). | |
Public Constructors | |
| fixed_array ()=default | |
| Initializes a new instance of the fixed_array class that is empty. | |
| fixed_array (std::initializer_list< type_t > items) | |
| Initializes a new instance of the fixed_array class with specified initializer list. | |
Public Properties | |
| auto | count () const noexcept -> size_type |
| Gets the number of elements contained in the xtd::fixed_array <type_t>. | |
| auto | data () const noexcept -> const_pointer |
| Returns pointer to the underlying array serving as element storage. | |
| auto | data () noexcept -> pointer |
| Returns pointer to the underlying array serving as element storage. | |
| virtual auto | empty () const noexcept -> bool |
| Checks if the container has no elements, i.e. whether xtd::array::begin() == xtd::array::end(). | |
| virtual auto | items () const noexcept -> const_base_type |
| Returns the underlying base type items. | |
| virtual auto | items () noexcept -> base_type |
| Returns the underlying base type items. | |
| virtual auto | length () const noexcept -> size_type |
| Gets a size that represents the total number of elements in all the dimensions of the array. | |
| auto | size () const noexcept -> size_type |
| Returns the number of elements in the container, i.e. std::distance(xtd::array::begin(), xtd::array::end()). | |
Public Methods | |
| auto | clear () noexcept -> void |
| Clears the contents of this xtd::span <type> object. | |
| auto | contains (const value_type &value) const noexcept -> bool |
| Determines whether an element is in the array. | |
| auto | copy_to (xtd::array< value_type > &array) const -> void |
| Copies the entire xtd::array <type_t> to a compatible one-dimensional array. | |
| auto | copy_to (xtd::array< value_type > &array, size_type array_index) const -> void |
| Copies the elements of the xtd::array <type_t> to an xtd::array, starting at a particular xtd::array index. | |
| auto | copy_to (const size_type index, xtd::array< value_type > &array, size_type array_index) const -> void |
| Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array, starting at a particular xtd::array index. | |
| auto | copy_to (const size_type index, xtd::array< value_type > &array, size_type array_index, size_type count) const -> void |
| Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array, starting at a particular xtd::array index. | |
| auto | equals (const object &obj) const noexcept -> bool override |
| Determines whether this instance and a specified object, which must also be a xtd::fixed_array object, have the same value. | |
| auto | equals (const fixed_array &rhs) const noexcept -> bool override |
| Determines whether this instance and another specified xtd::fixed_array object have the same value. | |
| auto | fill (const value_type &value) -> void |
| Fills the elements of this span with a specified value. | |
| auto | get_enumerator () const -> xtd::collections::generic::enumerator< value_type > override |
| Returns an enumerator that iterates through a collection. | |
| auto | index_of (const value_type &value) const noexcept -> size_type |
| Determines the index of a specific item in the xtd::array <type_t>. | |
| auto | index_of (const value_type &value, size_type index) const -> size_type |
| Determines the index of a specific item in the xtd::fixed_array <type_t>. | |
| auto | sort () -> fixed_array & |
| Determines the index of a specific item in the xtd::fixed_array <type_t>. | |
| template<typename comparison_t> | |
| auto | sort (comparison_t &&comparison) -> fixed_array & |
| Sorts the elements in the entire xtd::fixed_array <type_t> using the specified xtd::comparison <type_t>. | |
| auto | sort (const xtd::collections::generic::icomparer< type_t > &comparer) -> fixed_array & |
| Sorts the elements in the entire xtd::fixed_array <type_t> using the specified comparer. | |
| auto | sort (xtd::usize index, xtd::usize count, const xtd::collections::generic::icomparer< type_t > &comparer) -> fixed_array & |
| Sorts the elements in a range of elements in xtd::fixed_array <type_t> using the specified comparer. | |
| virtual auto | to_array () const noexcept -> xtd::array< value_type > |
| Copies the elements of the xtd::fixed_array <type_t> to a new array. | |
| auto | to_string () const noexcept -> xtd::string override |
| Returns a xtd::string that represents the current object. | |
Public Operators | |
| auto | operator[] (size_type index) const -> const_reference |
| Returns a reference to the element at specified location index. | |
| auto | operator[] (size_type index) -> reference |
| Returns a reference to the element at specified location index. | |
Additional Inherited Members | |
| using | value_type |
| Represents the xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of xtd::collections::generic::ienumerable value type. | |
| using | const_iterator |
| Represents the const iterator of xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of enumerable value type. | |
| using | const_iterator |
| Represents the const iterator of enumerable value type. | |
| using | enumerable_type |
| Represents the ienumerable enumerable type. | |
| using | source_type |
| Represents the ienumerable source type. | |
| using | ienumerable |
| Represents the ienumerable value type. | |
| using | list |
| Represents the list value type. | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual xtd::usize | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual auto | begin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| virtual auto | cbegin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| virtual auto | cend () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| virtual auto | end () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| auto | aggregate (const std::function< type_t(const type_t &, const type_t &)> &func) const -> type_t |
| Applies an accumulator function over a sequence. | |
| auto | all (const std::function< bool(const type_t &)> &predicate) const -> bool |
| Determines whether all elements of a sequence satisfy a condition. | |
| auto | any () const noexcept -> bool |
| Determines whether a sequence contains any elements. | |
| auto | append (const type_t &element) const noexcept |
| Appends a value to the end of the sequence. | |
| auto | as_enumerable () const noexcept |
| Returns the input typed as xtd::collections::generic::ienumerable <type_t>. | |
| auto | average () const noexcept |
| Computes the average of a sequence of source_t values. | |
| auto | cast () const noexcept |
| Casts the elements of an xtd::collections::generic::ienumerable to the specified type. | |
| auto | chunk (xtd::usize size) const |
| Splits the elements of a sequence into chunks of size at most size. | |
| auto | concat (const ienumerable< type_t > &second) const noexcept |
| Concatenates two sequences. | |
| auto | contains (const type_t &value) const noexcept -> bool |
| Determines whether a sequence contains a specified element by using the default equality comparer. | |
| auto | count () const noexcept -> xtd::usize |
| Returns the number of elements in current sequence. | |
| auto | count_by (const std::function< key_t(const type_t &)> &key_selector) const noexcept |
| Returns the count of elements in the current sequence grouped by key. | |
| auto | default_if_empty () const noexcept |
| Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty. | |
| auto | distinct () const noexcept |
| Returns distinct elements from a sequence by using the default equality comparer to compare values. | |
| auto | first_or_default (const std::function< bool(const type_t &)> &predicate, const type_t &default_value) const noexcept -> type_t |
| Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found. | |
| auto | order () const |
| Sorts the elements of a sequence in ascending order. | |
| auto | order_by (const std::function< type_t(const type_t &)> &key_selector) const |
| Sorts the elements of a sequence in ascending order according to a key. | |
| auto | order_by_descending (const std::function< key_t(const type_t &)> &key_selector) const |
| Sorts the elements of a sequence in descending order according to a key. | |
| auto | select (auto &&selector) const |
| Projects each element of a sequence into a new form. | |
| auto | to_array () const noexcept -> xtd::array< type_t > |
| Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | to_list () const noexcept -> xtd::collections::generic::list< type_t > |
| Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | where (auto &&predicate) const |
| Filters a sequence of values based on a predicate. | |
| virtual bool | equals (const type_t &) const noexcept=0 |
| Indicates whether the current object is equal to another object of the same type. | |
| template<typename object_a_t, typename object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
| static auto | to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| static auto | to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| using xtd::fixed_array< type_t, len >::value_type |
Represents the array value type.
| using xtd::fixed_array< type_t, len >::base_type |
Represents the array base type.
| using xtd::fixed_array< type_t, len >::const_base_type |
Represents the const array base type.
| using xtd::fixed_array< type_t, len >::reference |
Represents the reference of array value type.
| using xtd::fixed_array< type_t, len >::const_reference |
Represents the const reference of array value type.
| using xtd::fixed_array< type_t, len >::pointer |
Represents the pointer of array value type.
| using xtd::fixed_array< type_t, len >::const_pointer |
Represents the const pointer of array value type.
| using xtd::fixed_array< type_t, len >::size_type |
Represents the array size type (usually xtd::usize).
| using xtd::fixed_array< type_t, len >::difference_type |
Represents the array difference type (usually xtd::ptrdiff).
|
default |
Initializes a new instance of the fixed_array class that is empty.
|
inline |
Initializes a new instance of the fixed_array class with specified initializer list.
| items | The initializer list to initialize the elements of the container with. |
|
inlinenodiscardnoexcept |
Gets the number of elements contained in the xtd::fixed_array <type_t>.
|
inlinenodiscardnoexcept |
Returns pointer to the underlying array serving as element storage.
|
inlinenodiscardnoexcept |
Returns pointer to the underlying array serving as element storage.
|
inlinenodiscardvirtualnoexcept |
Checks if the container has no elements, i.e. whether xtd::array::begin() == xtd::array::end().
|
inlinenodiscardvirtualnoexcept |
Returns the underlying base type items.
|
inlinenodiscardvirtualnoexcept |
Returns the underlying base type items.
|
inlinenodiscardvirtualnoexcept |
Gets a size that represents the total number of elements in all the dimensions of the array.
|
inlinenodiscardnoexcept |
Returns the number of elements in the container, i.e. std::distance(xtd::array::begin(), xtd::array::end()).
|
inlinenoexcept |
Clears the contents of this xtd::span <type> object.
|
inlinenodiscardnoexcept |
Determines whether an element is in the array.
| value | The object to be added to the end of the array. |
|
inline |
Copies the entire xtd::array <type_t> to a compatible one-dimensional array.
| array | The one-dimensional xtd::array that is the destination of the elements copied from ICollection. The xtd::array must have zero-based indexing. |
| xtd::argument_exception | The number of elements in the source xtd::array <type_t> is greater than the number of elements that the destination array can contain. |
|
inline |
Copies the elements of the xtd::array <type_t> to an xtd::array, starting at a particular xtd::array index.
| array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::generic::icollection <type_t>. The xtd::array must have zero-based indexing. |
| array_index | The zero-based index in array at which copying begins. |
| xtd::argument_exception | The number of elements in the source xtd::array <type_t> is greater than the available space from `array_index` to the end of the destination `array`. |
|
inline |
Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array, starting at a particular xtd::array index.
| index | The zero-based index in the source fixed_array at which copying begins. |
| array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::generic::icollection <type_t>. The xtd::array must have zero-based indexing. |
| array_index | The zero-based index in array at which copying begins. |
| xtd::argument_exception | The number of elements in the source xtd::array <type_t> is greater than the available space from `array_index` to the end of the destination `array`. |
|
inline |
Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array, starting at a particular xtd::array index.
| index | The zero-based index in the source fixed_array at which copying begins. |
| array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::generic::icollection <type_t>. The xtd::array must have zero-based indexing. |
| array_index | The zero-based index in array at which copying begins. |
| count | The number of elements to copy. |
| xtd::argument_exception | The number of elements in the source xtd::array <type_t> is greater than the available space from `array_index` to the end of the destination `array`. |
|
inlinenodiscardoverridevirtualnoexcept |
Determines whether this instance and a specified object, which must also be a xtd::fixed_array object, have the same value.
| obj | The fixed_array to compare to this instance. |
Reimplemented from xtd::object.
|
inlinenodiscardoverridenoexcept |
Determines whether this instance and another specified xtd::fixed_array object have the same value.
| value | The fixed_array to compare to this instance. |
|
inline |
Fills the elements of this span with a specified value.
| value | The value to assign to each element of the span. |
|
inlinenodiscardoverridevirtual |
Returns an enumerator that iterates through a collection.
Implements xtd::collections::generic::ienumerable< type_t >.
|
inlinenodiscardnoexcept |
Determines the index of a specific item in the xtd::array <type_t>.
| value | The object to locate in the xtd::array. |
|
inlinenodiscard |
Determines the index of a specific item in the xtd::fixed_array <type_t>.
| value | The object to locate in the xtd::fixed_array <type_t>. |
| index | The zero-based starting index of the search. |
| xtd::argument_out_of_range_exception | `index` is outside the range of valid indexes for the xtd::fixed_array <type_t>. |
|
inline |
Determines the index of a specific item in the xtd::fixed_array <type_t>.
| value | The object to locate in the xtd::fixed_array <type_t>. |
| index | The zero-based starting index of the search. |
| count | The number of elements in the section to search |
| xtd::argument_out_of_range_exception | `index` and `countù do not specify a valid section in the xtd::fixed_array <type_t>. */ [[nodiscard]] auto index_of(const value_type& value, size_type index, size_type count) const -> size_type { if (index > length() || index + count > length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range); for (auto increment = index; increment < (index + count); ++increment) if (xtd::collections::generic::helpers::equator<type_t> {}(items_[increment], value)) return increment; return xtd::npos; } |
/** Sorts the elements in the entire xtd::fixed_array <type_t> using the default comparer.
| xtd::invalid_operation_exception | The default comparer xtd::collections::generic::comparer::default_comparer cannot find an implementation of the xtd::icomparable <type_t> generic interface. |
|
inline |
Sorts the elements in the entire xtd::fixed_array <type_t> using the specified xtd::comparison <type_t>.
| xtd::argument_exception | The implementation of comparison caused an error during the sort. For example, comparison might not return 0 when comparing an item with itself. |
|
inline |
Sorts the elements in the entire xtd::fixed_array <type_t> using the specified comparer.
| comparer | The xtd::collections::generic::icomparer <type_t> implementation to use when comparing elements, or null to use the default comparer xtd::collections::generic::comparer::default_comparer. |
| xtd::argument_exception | The implementation of comparison caused an error during the sort. For example, comparison might not return 0 when comparing an item with itself. |
|
inline |
Sorts the elements in a range of elements in xtd::fixed_array <type_t> using the specified comparer.
| index | The zero-based starting index of the range to sort. |
| count | The length of the range to sort. |
| comparer | The xtd::collections::generic::icomparer <type_t> implementation to use when comparing elements, or null to use the default comparer xtd::collections::generic::comparer::default_comparer. |
| xtd::argument_exception | The implementation of comparison caused an error during the sort. For example, comparison might not return 0 when comparing an item with itself. |
|
inlinenodiscardvirtualnoexcept |
Copies the elements of the xtd::fixed_array <type_t> to a new array.
|
inlinenodiscardoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
|
inline |
Returns a reference to the element at specified location index.
| index | The position of the element to return. |
| std::out_of_range | If `index` is not within the range of the container. |
|
inline |
Returns a reference to the element at specified location index.
| index | The position of the element to return. |