xtd 0.2.0
Loading...
Searching...
No Matches
array_2.hpp
Go to the documentation of this file.
1
4
5#if !defined(__XTD_ARRAY_INTERNAL__)
6#error "Do not include this file: Internal use only. Include <xtd/array> or <xtd/array.hpp> instead."
7#endif
8
10namespace xtd {
39 template<class type_t, class allocator_t>
40 class array<type_t, 2, allocator_t> : public xtd::basic_array<type_t, allocator_t> {
41 public:
43
46 using value_type = type_t;
72
74
81 array() = default;
84 array(const array& array) : basic_array<type_t, allocator_t>(array) {}
87 array(array&& array) : basic_array<type_t, allocator_t>(std::move(array)) {}
90 array(const base_type& array) : basic_array<type_t, allocator_t>(array) {}
93 array(base_type&& array) : basic_array<type_t, allocator_t>(std::move(array)) {}
101 array(size_type length1, size_type length2) : basic_array<type_t, allocator_t>(array<xtd::size> {length1, length2}) {}
110 array(size_type length1, size_type length2, const value_type& value) : basic_array<type_t, allocator_t>(array<xtd::size> {length1, length2}, value) {}
117 explicit array(const array<xtd::size, 1>& lengths) : xtd::basic_array<type_t, allocator_t>(lengths) {}
124 array(const array<xtd::size, 1>& lengths, const value_type& value) : basic_array<type_t, allocator_t>(lengths, value) {}
131 explicit array(const xtd::collections::generic::ienumerable<type_t>& enumerable) : basic_array<type_t, allocator_t>(enumerable) {}
138 explicit array(const xtd::collections::generic::ilist<type_t>& list) : basic_array<type_t, allocator_t>(list) {}
142 template<class input_iterator_t>
143 array(input_iterator_t first, input_iterator_t last) : basic_array<type_t, allocator_t>(first, last) {}
146 array(std::vector<std::vector<type_t>> items) : basic_array<type_t, allocator_t>(items) {}
149 array(std::initializer_list<std::initializer_list<type_t>> items) : basic_array<type_t, allocator_t>(items) {}
151
153
160 xtd::size rank() const noexcept override {return 2;}
162
164
166 using xtd::basic_array<type_t, allocator_t>::get_value;
173 const value_type& get_value(size_type index1, size_type index2) const {return operator()(index1, index2);}
174
175 using xtd::basic_array<type_t, allocator_t>::set_value;
182 void set_value(const value_type& value, size_type index1, size_type index2) {operator()(index1, index2) = value;}
183
186 xtd::string to_string() const noexcept override;
188
190
195 array& operator=(const array&) = default;
199 array& operator=(array&&) = default;
200
201 using xtd::basic_array<type_t, allocator_t>::operator();
211 value_type& operator()(size_type index1, size_type index2) {return xtd::basic_array<type_t, allocator_t>::operator()({index1, index2});}
212
222 const value_type& operator()(size_type index1, size_type index2) const {return xtd::basic_array<type_t, allocator_t>::operator()({index1, index2});}
224 };
225}
typename xtd::basic_array< type_t, allocator_t >::const_reverse_iterator const_reverse_iterator
Represents the const reverse iterator of array value type.
Definition array_2.hpp:70
array(base_type &&array)
Move constructor with specified base type array.
Definition array_2.hpp:93
array(const xtd::collections::generic::ienumerable< type_t > &enumerable)
Initializes a new instance of the array and copy array array specified.
Definition array_2.hpp:131
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
array(const base_type &array)
Copy constructor with specified base type array.
Definition array_2.hpp:90
const value_type & operator()(size_type index1, size_type index2) const
Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32...
Definition array_2.hpp:222
typename xtd::basic_array< type_t, allocator_t >::reverse_iterator reverse_iterator
Represents the reverse iterator of array value type.
Definition array_2.hpp:68
typename xtd::basic_array< type_t, allocator_t >::size_type size_type
Represents the array size type (usually xtd::size).
Definition array_2.hpp:52
xtd::size rank() const noexcept override
Gets the rank (number of dimensions) of the array.
Definition array_2.hpp:160
array(size_type length1, size_type length2)
Initializes a new instance of the array class with lengths for each rank specified.
Definition array_2.hpp:101
const value_type & get_value(size_type index1, size_type index2) const
Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32...
Definition array_2.hpp:173
typename xtd::basic_array< type_t, allocator_t >::iterator iterator
Represents the iterator of array value type.
Definition array_2.hpp:64
array(const array< xtd::size, 1 > &lengths, const value_type &value)
Initializes a new instance of the array class with lengths for each rank specified.
Definition array_2.hpp:124
typename xtd::basic_array< type_t, allocator_t >::const_reference const_reference
Represents the const reference of array value type.
Definition array_2.hpp:58
array(std::initializer_list< std::initializer_list< type_t > > items)
Constructs the container with the contents of the specified initializer list.
Definition array_2.hpp:149
typename xtd::basic_array< type_t, allocator_t >::allocator_type allocator_type
Represents the array allocator type.
Definition array_2.hpp:48
typename xtd::basic_array< type_t, allocator_t >::const_iterator const_iterator
Represents the const iterator of array value type.
Definition array_2.hpp:66
typename xtd::basic_array< type_t, allocator_t >::const_pointer const_pointer
Represents the const pointer of array value type.
Definition array_2.hpp:62
array(input_iterator_t first, input_iterator_t last)
Constructs the container with the contents of the range [first, last).
Definition array_2.hpp:143
type_t value_type
Represents the array value type.
Definition array_2.hpp:46
typename xtd::basic_array< type_t, allocator_t >::base_type base_type
Represents the array base type.
Definition array_2.hpp:50
typename xtd::basic_array< type_t, allocator_t >::reference reference
Represents the reference of array value type.
Definition array_2.hpp:56
array()=default
Initializes a new instance of the Array class that is empty.
array(const array< xtd::size, 1 > &lengths)
Initializes a new instance of the array class with lengths for each rank specified.
Definition array_2.hpp:117
array(size_type length1, size_type length2, const value_type &value)
Initializes a new instance of the array class with lengths for each rank specified and default value.
Definition array_2.hpp:110
array(array &&array)
Move constructor with specified array.
Definition array_2.hpp:87
array(const xtd::collections::generic::ilist< type_t > &list)
Initializes a new instance of the array and copy array array specified.
Definition array_2.hpp:138
void set_value(const value_type &value, size_type index1, size_type index2)
Sets a value to the element at the specified position in the one-dimensional Array....
Definition array_2.hpp:182
array(std::vector< std::vector< type_t > > items)
Constructs the container with the contents of the specified initializer list.
Definition array_2.hpp:146
typename xtd::basic_array< type_t, allocator_t >::pointer pointer
Represents the pointer of array value type.
Definition array_2.hpp:60
array(const array &array)
Copy constructor with specified array.
Definition array_2.hpp:84
typename xtd::basic_array< type_t, allocator_t >::difference_type difference_type
Represents the array difference type (usually xtd::ptrdiff).
Definition array_2.hpp:54
Base object that represent array.
Definition basic_array.hpp:27
const value_type & const_reference
Represents the const reference of array value type.
Definition basic_array.hpp:45
xtd::collections::generic::helpers::allocator< value_type > allocator_type
Represents the array allocator type.
Definition basic_array.hpp:35
void set_value(const type_t &value, const xtd::array< size_type > &indexes)
Definition basic_array.hpp:342
const value_type & get_value(const xtd::array< size_type > &indexes) const
typename xtd::collections::generic::ienumerable< type_t >::const_iterator const_iterator
Represents the const iterator of array value type.
Definition basic_array.hpp:53
xtd::ptrdiff difference_type
Represents the array difference type (usually xtd::ptrdiff).
Definition basic_array.hpp:41
const value_type * const_pointer
Represents the const pointer of array value type.
Definition basic_array.hpp:49
typename xtd::collections::generic::helpers::raw_array< value_type >::reverse_iterator reverse_iterator
Represents the reverse iterator of array value type.
Definition basic_array.hpp:55
value_type * pointer
Represents the pointer of array value type.
Definition basic_array.hpp:47
value_type & reference
Represents the reference of array value type.
Definition basic_array.hpp:43
typename xtd::collections::generic::helpers::raw_array< value_type, allocator_type >::base_type base_type
Represents the array base type.
Definition basic_array.hpp:37
virtual const base_type & items() const noexcept
Definition basic_array.hpp:113
typename xtd::collections::generic::helpers::raw_array< value_type >::const_reverse_iterator const_reverse_iterator
Represents the const reverse iterator of array value type.
Definition basic_array.hpp:57
typename xtd::collections::generic::ienumerable< type_t >::iterator iterator
Represents the iterator of array value type.
Definition basic_array.hpp:51
type_t & operator()(const xtd::array< size_type > &indexes)
xtd::size size_type
Represents the array size type (usually xtd::size).
Definition basic_array.hpp:39
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
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