5#if !defined(__XTD_ARRAY_INTERNAL__)
6#error "Do not include this file: Internal use only. Include <xtd/array> or <xtd/array.hpp> instead."
17 template<
typename type_t>
70 template<
typename type_t,
typename allocator_t>
91 template<
typename type_t,
typename allocator_t,
typename value_t>
114 template<
typename type_t,
typename allocator_t,
typename value_t>
123 if (position !=
array.data_->items.end() && !comparer.
compare(value, *position))
124 return std::distance(
array.data_->items.begin(), position);
125 return ~std::distance(
array.data_->items.begin(), position);
142 template<
typename type_t,
typename allocator_t,
typename value_t>
163 template<
typename type_t,
typename allocator_t,
typename value_t>
168 template<
typename type_t, xtd::usize rank,
typename allocator_t>
178 template<
typename type_t, xtd::usize rank,
typename allocator_t>
182 array.data_->items[
index + increment] = type_t {};
194 template<
typename source_type_t, xtd::usize source_rank,
typename source_allocator_t,
typename destination_type_t, xtd::usize destination_rank,
typename destination_allocator_t>
195 static auto constrained_copy(
const array<source_type_t, source_rank, source_allocator_t>& source_array,
const xtd::array<xtd::usize>& source_indexes,
array<destination_type_t, destination_rank, destination_allocator_t>& destination_array,
const xtd::array<xtd::usize>& destination_indexes,
xtd::usize length) ->
void {
constrained_copy(source_array, xtd::basic_array<source_type_t, source_allocator_t>::compute_index(source_indexes), destination_array, xtd::basic_array<destination_type_t, destination_allocator_t>::compute_index(destination_indexes),
length);}
205 template<
typename source_type_t, xtd::usize source_rank,
typename source_allocator_t,
typename destination_type_t, xtd::usize destination_rank,
typename destination_allocator_t>
213 auto tmp_array = destination_array;
214 for (
auto i = source_index;
i < (source_index +
length); ++
i)
215 tmp_array.data_->items[destination_index++] = source_array.data_->items[
i];
216 destination_array.data_->items.swap(tmp_array.data_->items);
226 template<
typename output_t,
typename input_t, xtd::usize rank,
typename allocator_t,
typename converter_t,
typename destination_allocator_t = xtd::collections::
generic::helpers::allocator<output_t>>
239 template<
typename source_type_t, xtd::usize source_rank,
typename source_allocator_t,
typename destination_type_t, xtd::usize destination_rank,
typename destination_allocator_t>
246 template<
typename source_type_t, xtd::usize source_rank,
typename source_allocator_t,
typename destination_type_t, xtd::usize destination_rank,
typename destination_allocator_t>
247 static auto copy(
const array<source_type_t, source_rank, source_allocator_t>& source_array,
const array<destination_type_t, destination_rank, destination_allocator_t>& destination_array,
xtd::usize length) ->
void {
copy(source_array, 0, destination_array, 0,
length);}
255 template<
typename source_type_t, xtd::usize source_rank,
typename source_allocator_t,
typename destination_type_t, xtd::usize destination_rank,
typename destination_allocator_t>
257 copy(source_array, source_array.compute_index(source_array, source_indexes), destination_array, destination_array.compute_index(destination_array, destination_indexes),
length);
266 template<
typename source_type_t, xtd::usize source_rank,
typename source_allocator_t,
typename destination_type_t, xtd::usize destination_rank,
typename destination_allocator_t>
281 template<
typename type_t,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
296 template<
typename type_t,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
312 template<
typename type_t,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
324 template<
typename type_t, xtd::usize rank,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
332 template<
typename type_t, xtd::usize rank,
typename allocator_t,
typename predicate_t>
334 for (
const type_t& elem :
array)
335 if (match(elem))
return true;
346 template<
typename type_t, xtd::usize rank,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
357 template<
typename type_t, xtd::usize rank,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
369 template<
typename type_t, xtd::usize rank,
typename allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
381 template<
typename type_t,
typename allocator_t>
387 template<
typename type_t,
typename allocator_t>
395 template<
typename type_t,
typename allocator_t>
static auto binary_search(const array< type_t, 1, allocator_t > &array, const value_t &value, const xtd::collections::generic::icomparer< type_t > &comparer) -> xtd::usize
Searches a range of elements in a one-dimensional sorted array for a value, using the specified xtd::...
Definition array_static.hpp:164
static auto exists(const xtd::array< type_t, rank, allocator_t > &array, predicate_t match) -> bool
Determines whether the xtd::array <type_t> contains elements that match the conditions defined by the...
Definition array_static.hpp:333
static auto binary_search(const array< type_t, 1, allocator_t > &array, xtd::usize index, xtd::usize count, const value_t &value, const xtd::collections::generic::icomparer< type_t > &comparer) -> xtd::usize
Searches a range of elements in a one-dimensional sorted array for a value, using the specified xtd::...
Definition array_static.hpp:115
static auto copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, const array< destination_type_t, destination_rank, destination_allocator_t > &destination_array) -> void
Copies a range of elements from an xtd::array starting at the first element and pastes them into anot...
Definition array_static.hpp:240
static auto resize(xtd::array< type_t, 1, allocator_t > &array, int32 new_size) -> void
Changes the number of elements of a one-dimensional array to the specified new size.
Definition array_static.hpp:382
static auto binary_search(const array< type_t, 1, allocator_t > &array, const value_t &value) -> xtd::usize
Searches an entire one-dimensional sorted array for a specific element, using the xtd::icomparable in...
Definition array_static.hpp:143
static auto constrained_copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, xtd::usize source_index, array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, xtd::usize destination_index, xtd::usize length) -> void
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
Definition array_static.hpp:206
static auto constrained_copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, const xtd::array< xtd::usize > &source_indexes, array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, const xtd::array< xtd::usize > &destination_indexes, xtd::usize length) -> void
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
Definition array_static.hpp:195
static auto copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, xtd::usize source_index, const array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, xtd::usize destination_index, xtd::usize length) -> void
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
static auto as_read_only(const xtd::array< type_t, 1, allocator_t > &array) -> xtd::collections::object_model::read_only_collection< type_t >
Returns a read-only wrapper for the specified array.
static auto binary_search(const array< type_t, 1, allocator_t > &array, int32 index, int32 length, const value_t &value) -> xtd::usize
Searches a range of elements in a one-dimensional sorted array for a value, using the xtd::icomparabl...
Definition array_static.hpp:92
static auto create_instance(xtd::usize length1, xtd::usize length2) -> xtd::array< type_t, 2, allocator_t >
Creates a two-dimensional xtd::array <type_t> of the specified Type and dimension lengths,...
Definition array_static.hpp:297
static auto reverse(xtd::array< type_t, 1, allocator_t > &array, int32 index, int32 count) -> void
Reverses the order of the elements in the specified range.
Definition array_static.hpp:396
static auto copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, const xtd::array< xtd::usize > &source_indexes, const array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, const xtd::array< xtd::usize > &destination_indexes, xtd::usize length) -> void
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
Definition array_static.hpp:256
static auto create_instance(xtd::usize length) -> xtd::array< type_t, 1, allocator_t >
Creates a one-dimensional xtd::array <type_t> of the specified Type and length, with zero-based index...
Definition array_static.hpp:282
static auto convert_all(const xtd::array< input_t, rank, allocator_t > &array, converter_t converter) -> xtd::array< output_t, rank, destination_allocator_t >
Converts an array of one type to an array of another type.
Definition array_static.hpp:227
static auto create_instance(const xtd::array< xtd::usize > &lengths) -> xtd::array< type_t, rank, allocator_t >
Creates a multidimensional xtd::array <type_t> of the specified Type and dimension lengths,...
Definition array_static.hpp:325
static auto index_of(const xtd::array< type_t, rank, allocator_t > &array, const type_t &value, xtd::usize index, xtd::usize count) -> xtd::usize
Determines the index of a specific item in the array specified.
Definition array_static.hpp:370
static auto clear(const array< type_t, rank, allocator_t > &array, xtd::usize index, xtd::usize length) -> void
Sets a range of elements in an array to the default value of each element type.
Definition array_static.hpp:179
static auto reverse(xtd::array< type_t, 1, allocator_t > &array) -> void
Reverses the order of the elements in the entire xtd::basic_array.
Definition array_static.hpp:388
static auto copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, const array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, xtd::usize length) -> void
Copies a range of elements from an xtd::array starting at the first element and pastes them into anot...
Definition array_static.hpp:247
static auto index_of(const xtd::array< type_t, rank, allocator_t > &array, const type_t &value, xtd::usize index) -> xtd::usize
Determines the index of a specific item in the array specified.
Definition array_static.hpp:358
static auto create_instance(xtd::usize length1, xtd::usize length2, xtd::usize length3) -> xtd::array< type_t, 3, allocator_t >
Creates a three-dimensional xtd::array <type_t> of the specified Type and dimension lengths,...
Definition array_static.hpp:313
static auto clear(const array< type_t, rank, allocator_t > &array) -> void
Clears the contents of an array.
Definition array_static.hpp:169
static auto index_of(const xtd::array< type_t, rank, allocator_t > &array, const type_t &value) noexcept -> xtd::usize
Determines the index of a specific item in the array specified.
Definition array_static.hpp:347
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
auto count() const noexcept -> size_type override
Definition basic_array.hpp:72
virtual auto length() const noexcept -> size_type
Definition basic_array.hpp:122
auto compare(const first_argument_type &x, const second_argument_type &y) const -> result_type override
Compares two entities and returns a value indicating whether one is less than, equal to,...
Definition comparer.hpp:66
static const comparer< xtd::any_object > default_comparer
Definition comparer.hpp:50
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Provides the base class for a generic read-only collection.
Definition read_only_collection.hpp:39
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Contains xtd::collections::generic::comparer <type_t> class.
xtd::delegate< output_t(input_t input)> converter
Represents a method that converts an object from one type to another type.
Definition converter.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
@ rank
The rank is not valid.
Definition exception_case.hpp:93
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:38
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
@ r
The R key.
Definition console_key.hpp:122
@ i
The I key.
Definition console_key.hpp:104
Contains xtd::collections::generic::helpers::lesser struct.
Contains classes that can be used as collections in the object model of a reusable library....
Definition read_only_collection.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
auto first() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:245
auto last() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:286
Implements a function object for compare data.
Definition lesser.hpp:39
Represents a type that can be used to index a collection either from the beginning or the end.
Definition index.hpp:38
Contains xtd::helpers::throw_helper class.