6#if !defined(__XTD_ARRAY_INTERNAL__)
7#error "Do not include this file: Internal use only. Include <xtd/array> or <xtd/array.h> instead."
18 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
19 array(type_t, type_t, allocator_t = allocator_t()) -> array<type_t, rank, allocator_t>;
21 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
22 array(std::initializer_list<type_t>) -> array<type_t, rank, allocator_t>;
24 template<typename type_t, xtd::size length, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
25 array(
const type_t(&
a)[length]) -> array<type_t, rank, allocator_t>;
27 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
30 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
33 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
34 array(
const std::vector<type_t>&) -> array<type_t, rank, allocator_t>;
36 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
37 array(
const array<type_t, rank, allocator_t>&) -> array<type_t, rank, allocator_t>;
39 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
40 array(std::vector<type_t>&&) -> array<type_t, rank, allocator_t>;
42 template<typename type_t, xtd::size rank = 1, typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>
::type>>
43 array(array<type_t, rank, allocator_t>&&) -> array<type_t, rank, allocator_t>;
47template<
typename type_t,
typename allocator_t>
49 return operator()(indexes);
52template<
typename type_t,
typename allocator_t>
57template<
typename type_t,
typename allocator_t>
60 for (
auto index1 =
xtd::size {0}; index1 < indexes.
size(); ++index1) {
61 if (indexes[index1] >= get_length(index1)) __throw_index_out_of_range_exception(__FILE__, __LINE__, __func__);
63 for (
auto index2 = index1 + 1; index2 < indexes.
size(); ++index2)
64 multiplicand *= get_length(index2);
65 position += indexes[index1] * multiplicand;
67 if (position >=
size()) __throw_index_out_of_range_exception(__FILE__, __LINE__, __func__);
68 return data_->items[position];
71template<
typename type_t,
typename allocator_t>
74 for (
auto index1 =
xtd::size {0}; index1 < indexes.
size(); ++index1) {
75 if (indexes[index1] >= get_length(index1)) __throw_index_out_of_range_exception(__FILE__, __LINE__, __func__);
77 for (
auto index2 = index1 + 1; index2 < indexes.
size(); ++index2)
78 multiplicand *= get_length(index2);
79 position += indexes[index1] * multiplicand;
81 if (position >=
size()) __throw_index_out_of_range_exception(__FILE__, __LINE__, __func__);
82 return data_->items[position];
85template<
typename type_t,
typename allocator_t>
87 data_->
items = base_type(std::accumulate(lengths.begin(), lengths.end(), size_type {0}));
88 data_->lower_bound.clear();
89 data_->upper_bound.clear();
90 for (
auto length : lengths) {
91 data_->lower_bound.push_back(0);
92 data_->upper_bound.push_back(length - 1);
97template<
typename type_t,
typename allocator_t>
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:58
Base object that represent array.
Definition basic_array.hpp:27
const value_type & get_value(const xtd::array< size_type > &indexes) const
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
virtual const base_type & items() const noexcept
Returns the underlying base type items.
Definition basic_array.hpp:163
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
type_t & operator()(const xtd::array< size_type > &indexes)
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::array::begin(),...
Definition basic_array.hpp:211
Represents text as a sequence of character units.
Definition basic_string.hpp:79
static basic_string join(const basic_string separator, const collection_t &values) noexcept
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:2296
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:35
Represents a collection of objects that can be individually accessed by index.
Definition ilist.hpp:41
Provides the base class for a generic read-only collection.
Definition read_only_collection.hpp:40
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::type_info type
Stores information about a type.
Definition type.hpp:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::collections::object_model::read_only_collection class.
Contains xtd::string alias.