5#if !defined(__XTD_ARRAY_INTERNAL__)
6#error "Do not include this file: Internal use only. Include <xtd/array> or <xtd/array.hpp> instead."
16 template<
class type_t>
69 template<
class type_t,
class allocator_t>
90 template<
class type_t,
class allocator_t>
113 template<
class type_t,
class allocator_t>
116 typename std::vector<type_t>::const_iterator
first =
array.array.begin();
117 typename std::vector<type_t>::const_iterator
last =
array.array.begin();
118 std::advance(
first, index);
122 if (position !=
array.array.end() && !comparer->Compare(value, *position))
123 return (
int32)std::distance(
array.array.begin(), position);
124 return (
int32)~std::distance(
array.array.begin(), position);
141 template<
class type_t,
class allocator_t>
162 template<
class type_t,
class allocator_t>
167 template<
class type_t, xtd::size rank,
class allocator_t>
177 template<
class type_t, xtd::size rank,
class allocator_t>
181 array.data_->items[index + increment] = type_t {};
193 template<
class source_type_t, xtd::size source_rank,
class source_allocator_t,
class destination_type_t, xtd::size destination_rank,
class destination_allocator_t>
194 static void constrained_copy(
const array<source_type_t, source_rank, source_allocator_t>& source_array,
const xtd::array<xtd::size>& source_indexes,
array<destination_type_t, destination_rank, destination_allocator_t>& destination_array,
const xtd::array<xtd::size>& destination_indexes,
xtd::size length) {
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);}
204 template<
class source_type_t, xtd::size source_rank,
class source_allocator_t,
class destination_type_t, xtd::size destination_rank,
class destination_allocator_t>
212 auto tmp_array = destination_array;
213 for (
auto i = source_index;
i < (source_index +
length); ++
i)
214 tmp_array.data_->
items[destination_index++] = source_array.data_->
items[
i];
215 destination_array.data_->
items.swap(tmp_array.data_->items);
225 template<
class output_t,
class input_t, xtd::size rank,
class allocator_t,
class converter_t,
class destination_allocator_t = xtd::collections::
generic::helpers::allocator<output_t>>
238 template<
class source_type_t, xtd::size source_rank,
class source_allocator_t,
class destination_type_t, xtd::size destination_rank,
class destination_allocator_t>
245 template<
class source_type_t, xtd::size source_rank,
class source_allocator_t,
class destination_type_t, xtd::size destination_rank,
class destination_allocator_t>
246 inline static void 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::size length) {
copy(source_array, 0, destination_array, 0,
length);}
254 template<
class source_type_t, xtd::size source_rank,
class source_allocator_t,
class destination_type_t, xtd::size destination_rank,
class destination_allocator_t>
256 copy(source_array, source_array.compute_index(source_array, source_indexes), destination_array, destination_array.compute_index(destination_array, destination_indexes),
length);
265 template<
class source_type_t, xtd::size source_rank,
class source_allocator_t,
class destination_type_t, xtd::size destination_rank,
class destination_allocator_t>
280 template<
class type_t,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
295 template<
class type_t,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
311 template<
typename type_t,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
323 template<
class type_t, xtd::size rank,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
331 template<
class type_t, xtd::size rank,
class allocator_t,
class predicate_t>
333 for (
const type_t& elem :
array)
334 if (match(elem))
return true;
345 template<
typename type_t, xtd::size rank,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
356 template<
typename type_t, xtd::size rank,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
368 template<
typename type_t, xtd::size rank,
class allocator_t = xtd::collections::
generic::helpers::allocator<type_t>>
380 template<
class type_t,
class allocator_t>
386 template<
class type_t,
class allocator_t>
394 template<
class type_t,
class allocator_t>
static xtd::array< type_t, 3, allocator_t > create_instance(xtd::size length1, xtd::size length2, xtd::size length3)
Creates a three-dimensional xtd::array <type_t> of the specified Type and dimension lengths,...
Definition array_static.hpp:312
static xtd::size index_of(const xtd::array< type_t, rank, allocator_t > &array, const type_t &value, xtd::size index)
Determines the index of a specific item in the array specified.
Definition array_static.hpp:357
static xtd::array< type_t, rank, allocator_t > create_instance(const xtd::array< xtd::size > &lengths)
Creates a multidimensional xtd::array <type_t> of the specified Type and dimension lengths,...
Definition array_static.hpp:324
static void 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::size length)
Copies a range of elements from an xtd::array starting at the first element and pastes them into anot...
Definition array_static.hpp:246
static bool exists(const xtd::array< type_t, rank, allocator_t > &array, predicate_t match)
Determines whether the xtd::array <type_t> contains elements that match the conditions defined by the...
Definition array_static.hpp:332
static void reverse(xtd::array< type_t, 1, allocator_t > &array)
Reverses the order of the elements in the entire xtd::basic_array.
Definition array_static.hpp:387
static xtd::size binary_search(const array< type_t, 1, allocator_t > &array, xtd::size index, xtd::size count, const type_t &value, const xtd::collections::generic::icomparer< type_t > &comparer)
Searches a range of elements in a one-dimensional sorted array for a value, using the specified xtd::...
Definition array_static.hpp:114
static void 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)
Copies a range of elements from an xtd::array starting at the first element and pastes them into anot...
Definition array_static.hpp:239
static xtd::size binary_search(const array< type_t, 1, allocator_t > &array, const type_t &value, const xtd::collections::generic::icomparer< type_t > &comparer)
Searches a range of elements in a one-dimensional sorted array for a value, using the specified xtd::...
Definition array_static.hpp:163
static xtd::size binary_search(const array< type_t, 1, allocator_t > &array, const type_t &value)
Searches an entire one-dimensional sorted array for a specific element, using the xtd::icomparable in...
Definition array_static.hpp:142
static xtd::collections::object_model::read_only_collection< type_t > as_read_only(const xtd::array< type_t, 1, allocator_t > &array)
Returns a read-only wrapper for the specified array.
static void resize(xtd::array< type_t, 1, allocator_t > &array, int32 new_size)
Changes the number of elements of a one-dimensional array to the specified new size.
Definition array_static.hpp:381
static xtd::size index_of(const xtd::array< type_t, rank, allocator_t > &array, const type_t &value) noexcept
Determines the index of a specific item in the array specified.
Definition array_static.hpp:346
static void copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, xtd::size source_index, const array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, xtd::size destination_index, xtd::size length)
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
static void copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, const xtd::array< xtd::size > &source_indexes, const array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, const xtd::array< xtd::size > &destination_indexes, xtd::size length)
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
Definition array_static.hpp:255
static xtd::size index_of(const xtd::array< type_t, rank, allocator_t > &array, const type_t &value, xtd::size index, xtd::size count)
Determines the index of a specific item in the array specified.
Definition array_static.hpp:369
static void reverse(xtd::array< type_t, 1, allocator_t > &array, int32 index, int32 count)
Reverses the order of the elements in the specified range.
Definition array_static.hpp:395
static xtd::array< type_t, 2, allocator_t > create_instance(xtd::size length1, xtd::size length2)
Creates a two-dimensional xtd::array <type_t> of the specified Type and dimension lengths,...
Definition array_static.hpp:296
static xtd::array< output_t, rank, destination_allocator_t > convert_all(const xtd::array< input_t, rank, allocator_t > &array, converter_t converter)
Converts an array of one type to an array of another type.
Definition array_static.hpp:226
static void constrained_copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, xtd::size source_index, array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, xtd::size destination_index, xtd::size length)
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
Definition array_static.hpp:205
static xtd::array< type_t, 1, allocator_t > create_instance(xtd::size length)
Creates a one-dimensional xtd::array <type_t> of the specified Type and length, with zero-based index...
Definition array_static.hpp:281
static void constrained_copy(const array< source_type_t, source_rank, source_allocator_t > &source_array, const xtd::array< xtd::size > &source_indexes, array< destination_type_t, destination_rank, destination_allocator_t > &destination_array, const xtd::array< xtd::size > &destination_indexes, xtd::size length)
Copies a range of elements from an xtd::array starting at the specified source index and pastes them ...
Definition array_static.hpp:194
static void clear(const array< type_t, rank, allocator_t > &array, xtd::size index, xtd::size length)
Sets a range of elements in an array to the default value of each element type.
Definition array_static.hpp:178
static int32 binary_search(const array< type_t, 1, allocator_t > &array, int32 index, int32 length, const type_t &value)
Searches a range of elements in a one-dimensional sorted array for a value, using the xtd::icomparabl...
Definition array_static.hpp:91
static void clear(const array< type_t, rank, allocator_t > &array)
Clears the contents of an array.
Definition array_static.hpp:168
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
xtd::size rank() const noexcept override
Gets the rank (number of dimensions) of the array.
Definition array.hpp:136
size_type count() const noexcept override
Definition basic_array.hpp:74
constexpr size_type get_length(size_type dimension) const
Gets the total number of elements in all the dimensions of the array.
Definition basic_array.hpp:257
constexpr size_type get_lower_bound(size_type dimension) const
Gets the lower bound of the specified dimension in the array.
Definition basic_array.hpp:279
virtual size_type length() const noexcept
Definition basic_array.hpp:124
virtual const base_type & items() const noexcept
Returns the underlying base type items.
Definition basic_array.hpp:113
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:38
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
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:37
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
@ r
The R key.
Definition console_key.hpp:122
@ i
The I key.
Definition console_key.hpp:104
Contains classes that can be used as collections in the object model of a reusable library....
Definition read_only_collection.hpp:15
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
read_only_span< type_t, count > first() const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:282
read_only_span< type_t, count > last() const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:307
Contains xtd::helpers::throw_helper class.