25 template<
typename type_t, xtd::usize len>
62 for (
const auto& item :
items)
63 items_[index++] = item;
88 [[nodiscard]]
auto data() noexcept ->
pointer {
return items_;}
92 [[nodiscard]]
virtual auto empty() const noexcept ->
bool {
return len ==
xtd::usize {0};}
121 for (
const auto& item : items_)
157 for (
auto i = index;
i < (index +
count); ++
i)
170 if (
count() != rhs.count())
return false;
179 for (
auto& item : *
this)
189 [[nodiscard]]
const value_type& current()
const override {
191 return items_[index_];
193 bool move_next()
override {
return ++index_ < items_.count();}
194 void reset()
override {index_ =
xtd::npos;}
221 for (
auto increment = index; increment < (index +
count); ++increment)
242 template<
typename comparison_t>
244 std::sort(items_, items_ +
length(), [&](
const type_t&
x,
const type_t&
y) {
return comparison(
x,
y) < 0;});
291 return items_[index ==
epos ?
size() - 1 : index];
298 return items_[index ==
epos ?
size() - 1 : index];
309 template<
typename type_t,
typename... args_t>
310 fixed_array(type_t, args_t...) -> fixed_array <type_t, 1 +
sizeof...(args_t)>;
Contains xtd::array class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
xtd::usize rank() const noexcept override
Gets the rank (number of dimensions) of the array.
Definition array.hpp:158
virtual auto length() const noexcept -> size_type
Gets a size that represents the total number of elements in all the dimensions of the array.
Definition basic_array.hpp:122
static auto join(const basic_string &separator, const collection_t &values) noexcept -> basic_string
Definition basic_string.hpp:1255
static const comparer< xtd::any_object > default_comparer
Definition comparer.hpp:50
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
Represents a fixed array class.
Definition fixed_array.hpp:26
virtual auto items() noexcept -> base_type
Returns the underlying base type items.
Definition fixed_array.hpp:99
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.
Definition fixed_array.hpp:266
auto data() const noexcept -> const_pointer
Returns pointer to the underlying array serving as element storage.
Definition fixed_array.hpp:84
xtd::usize size_type
Represents the array size type (usually xtd::usize).
Definition fixed_array.hpp:46
auto get_enumerator() const -> xtd::collections::generic::enumerator< value_type > override
Returns an enumerator that iterates through a collection.
Definition fixed_array.hpp:185
auto data() noexcept -> pointer
Returns pointer to the underlying array serving as element storage.
Definition fixed_array.hpp:88
auto fill(const value_type &value) -> void
Fills the elements of this span with a specified value.
Definition fixed_array.hpp:178
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.
Definition fixed_array.hpp:169
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
Definition fixed_array.hpp:278
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>.
Definition fixed_array.hpp:212
auto clear() noexcept -> void
Clears the contents of this xtd::span <type> object.
Definition fixed_array.hpp:116
const value_type * const_pointer
Represents the const pointer of array value type.
Definition fixed_array.hpp:44
auto count() const noexcept -> size_type
Gets the number of elements contained in the xtd::fixed_array <type_t>.
Definition fixed_array.hpp:79
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...
Definition fixed_array.hpp:164
value_type * pointer
Represents the pointer of array value type.
Definition fixed_array.hpp:42
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,...
Definition fixed_array.hpp:154
auto operator[](size_type index) const -> const_reference
Returns a reference to the element at specified location index.
Definition fixed_array.hpp:289
virtual auto to_array() const noexcept -> xtd::array< value_type >
Copies the elements of the xtd::fixed_array <type_t> to a new array.
Definition fixed_array.hpp:274
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 ...
Definition fixed_array.hpp:137
virtual auto items() const noexcept -> const_base_type
Returns the underlying base type items.
Definition fixed_array.hpp:96
auto size() const noexcept -> size_type
Returns the number of elements in the container, i.e. std::distance(xtd::array::begin(),...
Definition fixed_array.hpp:108
type_t value_type
Represents the array value type.
Definition fixed_array.hpp:32
fixed_array(std::initializer_list< type_t > items)
Initializes a new instance of the fixed_array class with specified initializer list.
Definition fixed_array.hpp:60
virtual auto empty() const noexcept -> bool
Checks if the container has no elements, i.e. whether xtd::array::begin() == xtd::array::end().
Definition fixed_array.hpp:92
auto sort() -> fixed_array &
Determines the index of a specific item in the xtd::fixed_array <type_t>.
Definition fixed_array.hpp:235
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,...
Definition fixed_array.hpp:145
const value_type * const_base_type
Represents the const array base type.
Definition fixed_array.hpp:36
xtd::ptrdiff difference_type
Represents the array difference type (usually xtd::ptrdiff).
Definition fixed_array.hpp:48
const value_type & const_reference
Represents the const reference of array value type.
Definition fixed_array.hpp:40
auto sort(comparison_t &&comparison) -> fixed_array &
Sorts the elements in the entire xtd::fixed_array <type_t> using the specified xtd::comparison <type_...
Definition fixed_array.hpp:243
auto index_of(const value_type &value) const noexcept -> size_type
Determines the index of a specific item in the xtd::array <type_t>.
Definition fixed_array.hpp:206
value_type & reference
Represents the reference of array value type.
Definition fixed_array.hpp:38
fixed_array()=default
Initializes a new instance of the fixed_array class that is empty.
value_type * base_type
Represents the array base type.
Definition fixed_array.hpp:34
virtual auto length() const noexcept -> size_type
Gets a size that represents the total number of elements in all the dimensions of the array.
Definition fixed_array.hpp:104
auto copy_to(xtd::array< value_type > &array) const -> void
Copies the entire xtd::array <type_t> to a compatible one-dimensional array.
Definition fixed_array.hpp:129
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.
Definition fixed_array.hpp:254
auto contains(const value_type &value) const noexcept -> bool
Determines whether an element is in the array.
Definition fixed_array.hpp:120
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains xtd::collections::generic::ienumerable <type_t> interface.
xtd::delegate< int32(type_t x, type_t y)> comparison
Represents the method that compares two objects of the same type.
Definition comparison.hpp:33
@ argument
The argument is not valid.
Definition exception_case.hpp:31
@ index_out_of_range
The index is out of range.
Definition exception_case.hpp:61
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
@ invalid_operation
The operation is not valid.
Definition exception_case.hpp:65
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
constexpr xtd::usize epos
Represents the index of the last valid element in a collection.
Definition epos.hpp:33
constexpr xtd::usize npos
Represents a value that is not a valid position in a collection.
Definition npos.hpp:26
std::ptrdiff_t ptrdiff
Represent the signed integer type of the result of subtracting two pointers.
Definition ptrdiff.hpp:23
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
@ y
The Y key.
Definition console_key.hpp:136
@ i
The I key.
Definition console_key.hpp:104
@ x
The X key.
Definition console_key.hpp:134
Contains xtd::iequatable interface.
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
xtd::usize size_type
Represents the read_only_span size type (usually xtd::usize).
Definition read_only_span.hpp:62
constexpr size_type size() const noexcept
Returns the number of elements.
Definition read_only_span.hpp:241
Contains xtd::npos constant.
Contains xtd::optional type.
Contains xtd::string alias.
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:39
Implements a function object for compare data.
Definition lesser.hpp:39
Represents a value_type struct.
Definition value_type.hpp:34
Contains xtd::helpers::throw_helper class.