xtd 0.2.0
Loading...
Searching...
No Matches
array_1.h
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.h> instead."
7#endif
8
10namespace xtd {
39 template<typename type_t, typename allocator_t>
40 class array_<type_t, 1, 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_(const 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>(array) {}
100 array_(size_type length) : basic_array<type_t, allocator_t>(array_<xtd::size> {length}) {}
103 array_(std::initializer_list<type_t> items) : basic_array<type_t, allocator_t>(items) {}
110 template<xtd::size length>
111 array_(const type_t(&array)[length]) : basic_array<type_t, allocator_t>(array, length) {}
119 array_(const type_t* array, size_type length) : basic_array<type_t, allocator_t>(array, length) {}
126 array_(const xtd::collections::generic::ienumerable<type_t>& enumerable) : basic_array<type_t, allocator_t>(enumerable) {}
133 array_(const xtd::collections::generic::ilist<type_t>& list) : basic_array<type_t, allocator_t>(list) {}
137 template<typename iterator_t>
138 array_(iterator_t first, iterator_t last) : basic_array<type_t, allocator_t>(first, last) {}
140
142
144 xtd::size rank() const noexcept override {return 1;}
146
148
150
167
168 using xtd::basic_array<type_t, allocator_t>::get_value;
174 const value_type& get_value(size_type index) const {return operator()(index);}
175
176 using xtd::basic_array<type_t, allocator_t>::set_value;
182 void set_value(const value_type& value, size_type index) {operator()(index) = value;}
184
185
187
189 array_& operator=(const array_&) = default;
190 array_& operator=(array_&&) = default;
191
192 using xtd::basic_array<type_t, allocator_t>::operator();
202
212
222
233 };
234}
typename xtd::basic_array< type_t, allocator_t >::const_iterator const_iterator
Represents the const iterator of array value type.
Definition array_1.h:66
const value_type & operator()(size_type index) const
Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32...
Definition array_1.h:211
void copy_to(xtd::array< type_t > &array, size_type index) const override
Copies all the elements of the current one-dimensional array to the specified one-dimensional array s...
Definition array_1.h:166
array_(const array_ &array)
Copy constructor with specified array.
Definition array_1.h:84
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_1.h:70
value_type & operator[](size_type index) override
Sets a value to the element at the specified position in the one-dimensional Array....
Definition array_1.h:221
typename xtd::basic_array< type_t, allocator_t >::const_pointer const_pointer
Represents the const pointer of array value type.
Definition array_1.h:62
array_(const array_ &&array)
Move constructor with specified array.
Definition array_1.h:87
typename xtd::basic_array< type_t, allocator_t >::reverse_iterator reverse_iterator
Represents the reverse iterator of array value type.
Definition array_1.h:68
array_(iterator_t first, iterator_t last)
Constructs the container with the contents of the range [first, last).
Definition array_1.h:138
xtd::size rank() const noexcept override
Gets the rank (number of dimensions) of the array.
Definition array_1.h:144
array_(const base_type &array)
Copy constructor with specified base type array.
Definition array_1.h:90
typename xtd::basic_array< type_t, allocator_t >::base_type base_type
Represents the array base type.
Definition array_1.h:50
array_(const type_t(&array)[length])
Initializes a new instance of the array and copy array[] type_t.
Definition array_1.h:111
array_(const type_t *array, size_type length)
Initializes a new instance of the array and copy array[] type_t with length specified.
Definition array_1.h:119
typename xtd::basic_array< type_t, allocator_t >::pointer pointer
Represents the pointer of array value type.
Definition array_1.h:60
typename xtd::basic_array< type_t, allocator_t >::allocator_type allocator_type
Represents the array allocator type.
Definition array_1.h:48
typename xtd::basic_array< type_t, allocator_t >::reference reference
Represents the reference of array value type.
Definition array_1.h:56
array_(std::initializer_list< type_t > items)
Constructs the container with the contents of the specified initializer list.
Definition array_1.h:103
array_(const xtd::collections::generic::ilist< type_t > &list)
Initializes a new instance of the array and copy array array specified.
Definition array_1.h:133
array_(base_type &&array)
Move constructor with specified base type array.
Definition array_1.h:93
void set_value(const value_type &value, size_type index)
Sets a value to the element at the specified position in the one-dimensional Array....
Definition array_1.h:182
typename xtd::basic_array< type_t, allocator_t >::difference_type difference_type
Represents the array difference type (usually xtd::ptrdiff).
Definition array_1.h:54
array_(size_type length)
Initializes a new instance of the array class with lengths for each rank specified.
Definition array_1.h:100
value_type & operator()(size_type index)
Sets a value to the element at the specified position in the one-dimensional Array....
Definition array_1.h:201
array_()=default
Initializes a new instance of the Array class that is empty.
typename xtd::basic_array< type_t, allocator_t >::const_reference const_reference
Represents the const reference of array value type.
Definition array_1.h:58
typename xtd::basic_array< type_t, allocator_t >::iterator iterator
Represents the iterator of array value type.
Definition array_1.h:64
array_(const xtd::collections::generic::ienumerable< type_t > &enumerable)
Initializes a new instance of the array and copy array array specified.
Definition array_1.h:126
const value_type & operator[](size_type index) const override
Gets the element at the specified index.
Definition array_1.h:231
const value_type & get_value(size_type index) const
Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32...
Definition array_1.h:174
typename xtd::basic_array< type_t, allocator_t >::size_type size_type
Represents the array size type (usually xtd::size).
Definition array_1.h:52
type_t value_type
Represents the array value type.
Definition array_1.h:46
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition __array_definition.h:49
Base object that represent array.
Definition basic_array.h:27
typename base_type::const_reverse_iterator const_reverse_iterator
Represents the const reverse iterator of array value type.
Definition basic_array.h:71
const value_type & const_reference
Represents the const reference of array value type.
Definition basic_array.h:59
typename xtd::collections::generic::ilist< type_t >::iterator iterator
Represents the iterator of array value type.
Definition basic_array.h:65
xtd::ptrdiff difference_type
Represents the array difference type (usually xtd::ptrdiff).
Definition basic_array.h:55
typename xtd::collections::generic::ilist< type_t >::const_iterator const_iterator
Represents the const iterator of array value type.
Definition basic_array.h:67
xtd::collections::generic::helpers::allocator< typename std::conditional< std::is_same< bool, value_type >::value, xtd::byte, value_type >::type > allocator_type
Represents the array allocator type.
Definition basic_array.h:49
typename base_type::reverse_iterator reverse_iterator
Represents the reverse iterator of array value type.
Definition basic_array.h:69
const value_type * const_pointer
Represents the const pointer of array value type.
Definition basic_array.h:63
value_type * pointer
Represents the pointer of array value type.
Definition basic_array.h:61
value_type & reference
Represents the reference of array value type.
Definition basic_array.h:57
void copy_to(xtd::array< type_t > &array, size_type index) const override
Copies the elements of the xtd::collections::generic::icollection <type_t> to an xtd::array,...
Definition basic_array.h:244
const_reference operator[](size_type index) const override
Returns a reference to the element at specified location index.
Definition basic_array.h:475
std::vector< typename std::conditional< std::is_same< bool, value_type >::value, xtd::byte, value_type >::type, allocator_type > base_type
Represents the array base type.
Definition basic_array.h:51
xtd::size size_type
Represents the array size type (usually xtd::size).
Definition basic_array.h:53
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.h:35
Represents a collection of objects that can be individually accessed by index.
Definition ilist.h:41
size_t size
Represents a size of any object in bytes.
Definition size.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
std::vector< type_t > array
Definition __array_definition.h:18