5#define __XTD_CORE_INTERNAL__
7#undef __XTD_CORE_INTERNAL__
28#define __XTD_ARRAY_INTERNAL__
31#undef __XTD_ARRAY_INTERNAL__
63 template<
typename type_t, xtd::usize rank_,
typename allocator_t>
64 class array :
public basic_array<type_t, allocator_t> {
111 array(array&& array) :
xtd::basic_array<type_t, allocator_t>(std::move(array)) {}
118 explicit array(
const array<xtd::usize, 1>& lengths) :
xtd::basic_array<type_t, allocator_t>(lengths) {}
143 template<
typename input_iterator_t>
147 array(std::initializer_list<type_t>
items) : basic_array<type_t, allocator_t>(
items) {}
175 array& operator=(const array&) = default;
179 array& operator=(array&&) = default;
183 friend class array<>;
184 array(const array<
xtd::
usize>& lengths,
bool) : basic_array<type_t, allocator_t>(lengths) {}
188#define __XTD_ARRAY_INTERNAL__
194#undef __XTD_ARRAY_INTERNAL__
195#define __XTD_CORE_INTERNAL__
197#undef __XTD_CORE_INTERNAL__
200template<
typename source_t,
typename enumerable_t>
205template<xtd::iterable source_t>
209 auto source_holder = __xtd_enumerable_holder<xtd::raw_type<source_t>> {std::forward<xtd::raw_type<source_t>>(source)};
210 auto buffer = std::vector<xtd::iterable_value_type<source_t>> {};
211 buffer.reserve(size);
213 for (
const auto& item : source_holder.get()) {
214 buffer.push_back(item);
215 if (buffer.size() == size) {
216 co_yield std::move(buffer);
218 buffer.reserve(size);
223 co_yield std::move(buffer);
226template<
typename source_t>
228 return xtd::array<source_t> {source};
Contains abstract_ keyword.
Contains xtd::array <type_t, 1> class.
Contains xtd::array <type_t, 2> class.
Contains xtd::array <type_t, 3> class.
Contains xtd::array class.
Contains xtd::array_abstract_object class.
Contains xtd::array <> class.
Contains xtd::basic_array class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
typename xtd::basic_array< xtd::string, allocator_t >::difference_type difference_type
Definition array.hpp:78
typename xtd::basic_array< xtd::string, allocator_t >::const_pointer const_pointer
Definition array.hpp:86
typename xtd::basic_array< xtd::string, allocator_t >::const_reference const_reference
Definition array.hpp:82
typename xtd::basic_array< xtd::string, allocator_t >::size_type size_type
Definition array.hpp:76
array(input_iterator_t first, input_iterator_t last)
Constructs the container with the contents of the range [first, last).
Definition array.hpp:144
typename xtd::basic_array< xtd::string, allocator_t >::pointer pointer
Definition array.hpp:84
xtd::usize rank() const noexcept override
Gets the rank (number of dimensions) of the array.
Definition array.hpp:158
array()=default
Initializes a new instance of the array class that is empty.
xtd::string value_type
Definition array.hpp:70
typename xtd::basic_array< xtd::string, allocator_t >::reverse_iterator reverse_iterator
Definition array.hpp:92
array(const array< xtd::usize, 1 > &lengths, const type_t &value)
Initializes a new instance of the array class with lengths for each rank specified.
Definition array.hpp:125
typename xtd::basic_array< xtd::string, allocator_t >::iterator iterator
Definition array.hpp:88
array(array &&array)
Move constructor with specified array.
Definition array.hpp:111
typename xtd::basic_array< xtd::string, allocator_t >::const_iterator const_iterator
Definition array.hpp:90
typename xtd::basic_array< xtd::string, allocator_t >::allocator_type allocator_type
Definition array.hpp:72
array(const xtd::collections::generic::ienumerable< type_t > &enumerable)
Initializes a new instance of the array and copy array array specified.
Definition array.hpp:132
array(const xtd::collections::generic::ilist< type_t > &list)
Initializes a new instance of the array and copy array array specified.
Definition array.hpp:139
array(const array< xtd::usize, 1 > &lengths)
Initializes a new instance of the array class with lengths for each rank specified.
Definition array.hpp:118
typename xtd::basic_array< xtd::string, allocator_t >::base_type base_type
Definition array.hpp:74
typename xtd::basic_array< xtd::string, allocator_t >::reference reference
Definition array.hpp:80
array(const array &array)
Copy constructor with specified array.
Definition array.hpp:108
typename xtd::basic_array< xtd::string, allocator_t >::const_reverse_iterator const_reverse_iterator
Definition array.hpp:94
array(std::initializer_list< type_t > items)
Constructs the container with the contents of the specified initializer list.
Definition array.hpp:147
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
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
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
xtd::usize size_type
Represents the array size type (usually xtd::usize).
Definition basic_array.hpp:39
virtual auto items() const noexcept -> const base_type &
Returns the underlying base type items.
Definition basic_array.hpp:111
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
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
Represents an enumerable generator that supports deferred, lazy iteration over a collection of a spec...
Definition enumerable_generator.hpp:44
auto to_array() const -> xtd::array< value_t >
Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
typename xtd::linq::enumerable::list< type_t > list
Definition enumerable.hpp:47
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
Represents a collection of objects that can be individually accessed by index.
Definition ilist.hpp:43
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
static auto chunk(source_t &&source, xtd::usize size) -> xtd::collections::generic::enumerable_generator< xtd::array< xtd::iterable_value_type< source_t > > >
Splits the elements of a sequence into chunks of size at most size.
static auto to_array(const ienumerable< source_t > &source)
Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
Contains core_export_ keyword.
Contains xtd::collections::generic::helpers::equator struct.
Contains xtd::collections::generic::comparer <type_t> class.
Contains xtd::collections::generic::enumerator <type_t> class.
Contains xtd::collections::generic::icomparer <type_t> interface.
Contains xtd::collections::generic::ilist <type_t> interface.
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
Contains xtd::iequatable interface.
Contains xtd::int64 type.
Contains xtd::collections::generic::helpers::lesser struct.
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:248
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:273
Contains xtd::new_ptr method.
Contains xtd::null pointer valiue.
Contains xtd::object class.
Contains xtd::collections::generic::helpers::raw_array class.
Contains xtd::static_object class.
Contains xtd::helpers::throw_helper class.