xtd 1.0.0
Loading...
Searching...
No Matches
basic_array.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 {
26 template<typename type_t, typename allocator_t = xtd::collections::generic::helpers::allocator<type_t>>
27 class basic_array : public xtd::array_abstract_object, public xtd::collections::generic::ilist<type_t>, public xtd::iequatable<basic_array<type_t, allocator_t >> {
28 public:
30
33 using value_type = type_t;
49 using const_pointer = const value_type*;
59
61 basic_array(basic_array&& array) = default;
62 basic_array(const basic_array & array) requires std::copy_constructible<type_t> { if (array.data_) *data_ = *array.data_;}
64
66
72 [[nodiscard]] auto count() const noexcept -> size_type override {return data_->items.size();}
73
77 [[nodiscard]] virtual auto data() noexcept -> pointer {return (pointer)data_->items.data();}
81 [[nodiscard]] virtual auto data() const noexcept -> const_pointer {return (pointer)data_->items.data();}
82
86 [[nodiscard]] auto is_fixed_size() const noexcept -> bool override {return true;}
87
91 [[nodiscard]] auto is_read_only() const noexcept -> bool override {return false;}
92
107 [[nodiscard]] auto is_synchronized() const noexcept -> bool override {return false;}
108
111 [[nodiscard]] virtual auto items() const noexcept -> const base_type& {return data_->items;}
114 [[nodiscard]] virtual auto items() noexcept -> base_type& {return data_->items;}
115
122 [[nodiscard]] virtual auto length() const noexcept -> size_type {return data_->items.size();}
126 [[nodiscard]] virtual auto long_length() -> xtd::int64 {return static_cast<xtd::int64>(length());}
127
130 [[nodiscard]] virtual auto max_length() const noexcept -> size_type {return data_->items.max_size();}
131
137 [[nodiscard]] virtual auto rank() const noexcept -> size_type {return 1;}
138
160 [[nodiscard]] auto sync_root() const noexcept -> const xtd::object& override {return data_->sync_root;}
162
164
168 [[nodiscard]] auto contains(const type_t& value) const noexcept -> bool override {
169 for (const auto& item : data_->items)
170 if (xtd::collections::generic::helpers::equator<type_t> {}(reinterpret_cast<const type_t&>(item), value)) return true;
171 return false;
172 }
173
177 auto copy_to(xtd::array<type_t>& array) const -> void requires std::copy_constructible<type_t> {
178 copy_to(0, array, 0);
179 }
180
185 auto copy_to(xtd::array<type_t>& array, size_type array_index) const -> void override {
186 if constexpr (std::copy_constructible<type_t>) copy_to(0, array, array_index);
187 else xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, "value_type is not copy constructible.");
188 }
189
194 auto copy_to(const xtd::array<size_type>& indexes, xtd::array<type_t>& array, size_type array_index) const -> void requires std::copy_constructible<type_t> {
195 copy_to(compute_index(self_, indexes), array, array_index);
196 }
197
203 auto copy_to(const xtd::array<size_type>& indexes, xtd::array<type_t>& array, size_type array_index, size_type count) const -> void requires std::copy_constructible<type_t> {
204 copy_to(compute_index(self_, indexes), array, array_index, count);
205 }
206
211 auto copy_to(const size_type index, xtd::array<type_t>& array, size_type array_index) const -> void requires std::copy_constructible<type_t> {
212 copy_to(index, array, array_index, length() - index);
213 }
214
220 auto copy_to(const size_type index, xtd::array<type_t>& array, size_type array_index, size_type count) const -> void requires std::copy_constructible<type_t> {
222 if (index + count > self_.length() || array_index + count > array.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
223 for (auto i = index; i < (index + count); ++i)
224 array[array_index++] = self_[i];
225 }
226
230 [[nodiscard]] auto equals(const object & obj) const noexcept -> bool override {return dynamic_cast<const basic_array<value_type>*>(&obj) && equals(static_cast<const basic_array<value_type>&>(obj));}
235 [[nodiscard]] auto equals(const basic_array & rhs) const noexcept -> bool override {
236 if (count() != rhs.count()) return false;
237 for (size_type i = 0; i < count(); i++)
238 if (!xtd::collections::generic::helpers::equator<type_t> {}(data_->items.at(i), rhs.data_->items.at(i))) return false;
239 return data_->lower_bound == rhs.data_->lower_bound && data_->upper_bound == rhs.data_->upper_bound;
240 }
241
244 virtual auto fill(const value_type & value) noexcept -> void {
245 if constexpr (std::copy_constructible<value_type>)
246 for (auto& item : data_->items)
247 item = value;
248 else xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, "value_type is not copy constructible.");
249 }
250
251 [[nodiscard]] auto get_enumerator() const noexcept -> xtd::collections::generic::enumerator<value_type> override {
252 struct basic_array_enumerator : public xtd::collections::generic::ienumerator<value_type> {
253 explicit basic_array_enumerator(const basic_array & items, size_type version) : items_(items), version_(version) {}
254
255 [[nodiscard]] const value_type& current() const override {
257 if (version_ != items_.data_->items.version()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, "Collection was modified; enumeration operation may not execute.");
258 return items_[index_];
259 }
260
261 bool move_next() override {
262 if (version_ != items_.data_->items.version()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, "Collection was modified; enumeration operation may not execute.");
263 return ++index_ < items_.count();
264 }
265
266 void reset() override {
267 version_ = items_.data_->items.version();
268 index_ = basic_array::npos;
269 }
270
271 private:
273 const basic_array& items_;
274 size_type version_ = 0;
275 };
276 return {new_ptr<basic_array_enumerator>(*this, data_->items.version())};
277 }
278
286 [[nodiscard]] constexpr auto get_length(size_type dimension) const -> size_type {return get_upper_bound(dimension) - get_lower_bound(dimension) + 1;}
287
290 [[nodiscard]] auto get_lengths() const -> xtd::array<size_type, 1>;
291
299 [[nodiscard]] constexpr auto get_long_length(size_type dimension) const -> xtd::int64 {return static_cast<xtd::int64>(get_upper_bound(dimension) - get_lower_bound(dimension) + 1);}
300
308 [[nodiscard]] constexpr auto get_lower_bound(size_type dimension) const -> size_type {
310 return data_->lower_bound[dimension];
311 }
312
320 [[nodiscard]] constexpr auto get_upper_bound(size_type dimension) const -> size_type {
322 return data_->upper_bound[dimension];
323 }
324
329 [[nodiscard]] auto get_value(const xtd::array<size_type>& indexes) const -> const value_type&;
330
334 [[nodiscard]] auto index_of(const type_t& value) const noexcept -> size_type override {return index_of(value, 0, length());}
340 [[nodiscard]] auto index_of(const type_t& value, size_type index) const -> size_type {return index_of(value, index, length() - index);}
347 [[nodiscard]] auto index_of(const type_t& value, size_type index, size_type count) const -> size_type {
349 for (auto increment = index; increment < (index + count); ++increment)
350 if (xtd::collections::generic::helpers::equator<type_t> {}(data_->items[increment], value)) return increment;
351 return xtd::npos;
352 }
353
359 auto resize(size_type new_size) -> void {resize(new_size, value_type {});}
360
367 auto resize(size_type new_size, value_type value) -> void {
368 if (new_size == length()) return;
371 data_->items.resize(new_size, value);
372 data_->upper_bound[0] = new_size - 1;
373 }
374
379 auto set_value(const type_t& value, const xtd::array<size_type>& indexes) -> void {operator()(indexes) = value;}
380
391
397 template<typename comparison_t>
398 auto sort(comparison_t&& comparison) -> basic_array<type_t>& {
399 data_->items.increment_version();
400 std::sort(data_->items.begin(), data_->items.end(), [&](const type_t& x, const type_t& y) {return comparison(x, y) < 0;});
401 return self_;
402 }
403
410 auto sort(const xtd::collections::generic::icomparer<type_t>& comparer) -> basic_array<type_t>& {
411 return sort(0, count(), comparer);
412 }
413
422 auto sort(xtd::usize index, xtd::usize count, const xtd::collections::generic::icomparer<type_t>& comparer) -> basic_array<type_t>& {
424 data_->items.increment_version();
425 std::sort(data_->items.begin(), data_->items.end(), xtd::collections::generic::helpers::lesser<type_t> {comparer});
426 return self_;
427 }
428
431 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
433
435
440 auto operator =(const basic_array & other) -> basic_array& {
441 *data_ = *other.data_;
442 return *this;
443 }
444
447 auto operator =(basic_array&& other) noexcept -> basic_array& = default;
451 auto operator =(std::initializer_list<type_t>& items) -> basic_array& {
452 data_->items = items;
453 data_->upper_bound[0] = data_->items.size() - 1;
454 return *this;
455 }
456
461 [[nodiscard]] auto operator [](size_type index) const -> const_reference override {
463 return data_->items.at(index);
464 }
465
469 [[nodiscard]] auto operator [](size_type index) -> reference override {
471 return data_->items.at(index);
472 }
473
476 [[nodiscard]] operator const base_type&() const noexcept {return data_->items;}
479 [[nodiscard]] operator base_type&() noexcept {return data_->items;}
480
488 [[nodiscard]] auto operator()(const xtd::array<size_type>& indexes) -> type_t&;
489
497 [[nodiscard]] auto operator()(const xtd::array<size_type>& indexes) const -> const type_t&;
498
506 [[nodiscard]] auto operator[](const xtd::array<size_type>& indexes) -> type_t&;
507
515 [[nodiscard]] auto operator[](const xtd::array<size_type>& indexes) const -> const type_t&;
517
518 private:
519 template<typename type_array_t, size_type rank_array_t, typename allocator_array_t>
520 friend class array;
521
522 basic_array() = default;
523 explicit basic_array(const array<size_type, 1>& lengths);
524 basic_array(const array<size_type, 1>& lengths, const value_type & value);
525 basic_array(const_pointer array, size_type length) requires std::copy_constructible<type_t> {
527 data_->items = base_type {array, array + length};
528 data_->upper_bound[0] = data_->items.size() - 1;
529 }
530 explicit basic_array(const xtd::collections::generic::ienumerable<type_t>& enumerable) requires std::copy_constructible<type_t> {
531 for (const auto& value : enumerable)
532 data_->items.push_back(value);
533 data_->upper_bound[0] = data_->items.size() - 1;
534 }
535 explicit basic_array(const xtd::collections::generic::ilist<type_t>& items) requires std::copy_constructible<type_t> {
536 data_->items.reserve(items.count());
537 for (const auto& value : items)
538 data_->items.push_back(value);
539 data_->upper_bound[0] = data_->items.size() - 1;
540 }
541
542 template<typename input_iterator_t>
543 basic_array(input_iterator_t first, input_iterator_t last) requires std::copy_constructible<type_t> {
544 data_->items.assign(first, last);
545 data_->upper_bound[0] = data_->items.size() - 1;
546 }
547
548 basic_array(const std::vector<type_t>& items) requires std::copy_constructible<type_t> {
549 data_->items.assign(items.begin(), items.end());
550 data_->upper_bound[0] = data_->items.size() - 1;
551 }
552
553 basic_array(const std::vector<std::vector<type_t>>& items) requires std::copy_constructible<type_t> {
554 for (const std::vector<type_t>& items1 : items)
555 data_->items.insert(data_->items.end(), items1.begin(), items1.end());
556 data_->upper_bound[0] = items.size() - 1;
557 data_->lower_bound.push_back(0);
558 data_->upper_bound.push_back((*items.begin()).size() - 1);
559 }
560
561 basic_array(const std::vector<std::vector<std::vector<type_t>>>& items) requires std::copy_constructible<type_t> {
562 for (const std::vector<std::vector<type_t>>& items1 : items)
563 for (const std::vector<type_t>& items2 : items1)
564 data_->items.insert(data_->items.end(), items2.begin(), items2.end());
565 data_->upper_bound[0] = items.size() - 1;
566 data_->lower_bound.push_back(0);
567 data_->upper_bound.push_back((*items.begin()).size() - 1);
568 data_->lower_bound.push_back(0);
569 data_->upper_bound.push_back((*(*items.begin()).begin()).size() - 1);
570 }
571
572 basic_array(std::initializer_list<type_t> il) requires std::copy_constructible<type_t> {
573 data_->items.assign(il.begin(), il.end());
574 data_->upper_bound[0] = data_->items.size() - 1;
575 }
576
577 basic_array(std::initializer_list<std::initializer_list<type_t>> il) requires std::copy_constructible<type_t> {
578 for (const std::initializer_list<type_t>& il1 : il)
579 data_->items.insert(data_->items.end(), il1.begin(), il1.end());
580 data_->upper_bound[0] = il.size() - 1;
581 data_->lower_bound.push_back(0);
582 data_->upper_bound.push_back((*il.begin()).size() - 1);
583 }
584
585 basic_array(std::initializer_list<std::initializer_list<std::initializer_list<type_t>>> il) requires std::copy_constructible<type_t> {
586 for (const std::initializer_list<std::initializer_list<type_t>>& il1 : il)
587 for (const std::initializer_list<type_t>& il2 : il1)
588 data_->items.insert(data_->items.end(), il2.begin(), il2.end());
589 data_->upper_bound[0] = il.size() - 1;
590 data_->lower_bound.push_back(0);
591 data_->upper_bound.push_back((*il.begin()).size() - 1);
592 data_->lower_bound.push_back(0);
593 data_->upper_bound.push_back((*(*il.begin()).begin()).size() - 1);
594 }
595
596 auto add(const type_t& item) -> void override {}
597
598 auto clear() -> void override {fill(value_type {});}
599
600 template<typename value_t>
601 [[nodiscard]] static auto compute_index(const xtd::basic_array<value_t>& items, const xtd::array<size_type>& indexes) -> xtd::usize;
602 template<typename value_t>
603 [[nodiscard]] static auto compute_index(const xtd::basic_array<value_t>& items, xtd::usize rank, xtd::usize index) -> xtd::usize;
604
605 auto insert(size_type index, const type_t& value) -> void override {}
606
607 auto remove(const type_t& item) -> bool override {return false;}
608
609 auto remove_at(size_type index) -> void override {}
610
611 auto reverse(size_type index, size_type count) -> void {
613 if (count == 0) return;
614 data_->items.increment_version();
615 std::reverse(data_->items.begin() + index, data_->items.begin() + index + count);
616 }
617
618 template<typename value_t>
619 [[nodiscard]] static auto to_string(const xtd::basic_array<value_t>& items, xtd::usize rank, xtd::usize base_index) -> xtd::string;
620
621 struct array_data {
622 xtd::collections::generic::helpers::raw_array<value_type> items;
623 std::vector<size_type> lower_bound {0};
624 std::vector<size_type> upper_bound {std::numeric_limits<size_type>::max()};
625 object sync_root;
626 };
627
629 };
630}
Abstract object that represent array.
Definition array_abstract_object.hpp:25
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
const value_type & const_reference
Represents the const reference of array value type.
Definition basic_array.hpp:45
auto is_read_only() const noexcept -> bool override
Gets a value indicating whether the xtd::collections::generic::icollection <type_t> is read-only.
Definition basic_array.hpp:91
xtd::collections::generic::helpers::allocator< value_type > allocator_type
Represents the array allocator type.
Definition basic_array.hpp:35
auto is_synchronized() const noexcept -> bool override
Gets a value indicating whether access to the xtd::collections::generic::icollection <type_t> is sync...
Definition basic_array.hpp:107
auto is_fixed_size() const noexcept -> bool override
Gets a value indicating whether the xtd::collections::generic::ilist <type_t> has a fixed size.
Definition basic_array.hpp:86
auto get_value(const xtd::array< size_type > &indexes) const -> const value_type &
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
virtual auto data() const noexcept -> const_pointer
Returns pointer to the underlying array serving as element storage.
Definition basic_array.hpp:81
virtual auto rank() const noexcept -> size_type
Gets the rank (number of dimensions) of the array.
Definition basic_array.hpp:137
typename xtd::collections::generic::ienumerable< type_t >::const_iterator const_iterator
Represents the const iterator of array value type.
Definition basic_array.hpp:53
auto copy_to(xtd::array< type_t > &array) const -> void
Copies the entire xtd::array <type_t> to a compatible one-dimensional array.
Definition basic_array.hpp:177
xtd::ptrdiff difference_type
Represents the array difference type (usually xtd::ptrdiff).
Definition basic_array.hpp:41
auto get_lengths() const -> xtd::array< size_type, 1 >
Gets an array of the number of elements of all the dimensions of the array.
xtd::usize size_type
Represents the array size type (usually xtd::usize).
Definition basic_array.hpp:39
auto copy_to(const xtd::array< size_type > &indexes, xtd::array< type_t > &array, size_type array_index) const -> void
Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array,...
Definition basic_array.hpp:194
auto sync_root() const noexcept -> const xtd::object &override
Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollecti...
Definition basic_array.hpp:160
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
auto index_of(const type_t &value, size_type index) const -> size_type
Determines the index of a specific item in the xtd::basic_array <type_t>.
Definition basic_array.hpp:340
auto operator[](const xtd::array< size_type > &indexes) -> type_t &
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
virtual auto items() const noexcept -> const base_type &
Returns the underlying base type items.
Definition basic_array.hpp:111
constexpr auto get_length(size_type dimension) const -> size_type
Gets the total number of elements in all the dimensions of the array.
Definition basic_array.hpp:286
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
virtual auto long_length() -> xtd::int64
Gets a 64-bit integer that represents the total number of elements in all the dimensions of the array...
Definition basic_array.hpp:126
constexpr auto get_long_length(size_type dimension) const -> xtd::int64
Gets a 64-bit integer that represents the total number of elements in all the dimensions of the array...
Definition basic_array.hpp:299
value_type & reference
Represents the reference of array value type.
Definition basic_array.hpp:43
auto operator()(const xtd::array< size_type > &indexes) -> type_t &
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
auto count() const noexcept -> size_type override
Gets the number of elements contained in the xtd::array <type_t>.
Definition basic_array.hpp:72
auto copy_to(const size_type index, xtd::array< type_t > &array, size_type array_index) const -> void
Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array,...
Definition basic_array.hpp:211
auto copy_to(const xtd::array< size_type > &indexes, xtd::array< type_t > &array, size_type array_index, size_type count) const -> void
Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array,...
Definition basic_array.hpp:203
auto get_enumerator() const noexcept -> xtd::collections::generic::enumerator< value_type > override
Returns an enumerator that iterates through a collection.
Definition basic_array.hpp:251
type_t value_type
Represents the array value type.
Definition basic_array.hpp:33
auto set_value(const type_t &value, const xtd::array< size_type > &indexes) -> void
Determines the index of a specific item in the xtd::basic_array <type_t>.
Definition basic_array.hpp:379
auto copy_to(const size_type index, xtd::array< type_t > &array, size_type array_index, size_type count) const -> void
Copies the elements of the xtd::array <type_t> from a specified index to an xtd::array,...
Definition basic_array.hpp:220
virtual auto length() const noexcept -> size_type
Gets a size that represents the total number of elements in all the dimensions of the array.
Definition basic_array.hpp:122
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
auto sort(xtd::usize index, xtd::usize count, const xtd::collections::generic::icomparer< type_t > &comparer) -> basic_array< type_t > &
Sorts the elements in a range of elements in xtd::basic_array <type_t> using the specified comparer.
Definition basic_array.hpp:422
auto operator[](size_type index) const -> const_reference override
Returns a reference to the element at specified location index.
Definition basic_array.hpp:461
auto operator[](const xtd::array< size_type > &indexes) const -> const type_t &
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
auto contains(const type_t &value) const noexcept -> bool override
Determines whether an element is in the array.
Definition basic_array.hpp:168
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
constexpr auto get_lower_bound(size_type dimension) const -> size_type
Gets the lower bound of the specified dimension in the array.
Definition basic_array.hpp:308
auto copy_to(xtd::array< type_t > &array, size_type array_index) const -> void override
Copies the elements of the xtd::array <type_t> to an xtd::array, starting at a particular xtd::array ...
Definition basic_array.hpp:185
virtual auto fill(const value_type &value) noexcept -> void
Assigns the value to all elements in the container.
Definition basic_array.hpp:244
auto operator()(const xtd::array< size_type > &indexes) const -> const type_t &
Gets the value at the specified position in the multidimensional array. The indexes are specified as ...
virtual auto max_length() const noexcept -> size_type
Returns the maximum number of elements the container is able to hold due to system or library impleme...
Definition basic_array.hpp:130
auto equals(const object &obj) const noexcept -> bool override
Determines whether this instance and a specified object, which must also be a xtd::basic_array object...
Definition basic_array.hpp:230
typename xtd::collections::generic::ienumerable< type_t >::iterator iterator
Represents the iterator of array value type.
Definition basic_array.hpp:51
auto operator=(const basic_array &other) -> basic_array &
Copy assignment operator. Replaces the contents with a copy of the contents of other.
Definition basic_array.hpp:440
auto sort() -> basic_array< type_t > &
Sorts the elements in the entire xtd::basic_array <type_t> using the default comparer.
Definition basic_array.hpp:390
auto index_of(const type_t &value) const noexcept -> size_type override
Determines the index of a specific item in the xtd::array <type_t>.
Definition basic_array.hpp:334
auto equals(const basic_array &rhs) const noexcept -> bool override
Determines whether this instance and another specified xtd::basic_array object have the same value.
Definition basic_array.hpp:235
auto sort(comparison_t &&comparison) -> basic_array< type_t > &
Sorts the elements in the entire xtd::basic_array <type_t> using the specified xtd::comparison <type_...
Definition basic_array.hpp:398
virtual auto data() noexcept -> pointer
Returns pointer to the underlying array serving as element storage.
Definition basic_array.hpp:77
constexpr auto get_upper_bound(size_type dimension) const -> size_type
Gets the upper bound of the specified dimension in the array.
Definition basic_array.hpp:320
virtual auto items() noexcept -> base_type &
Returns the underlying base type items.
Definition basic_array.hpp:114
auto sort(const xtd::collections::generic::icomparer< type_t > &comparer) -> basic_array< type_t > &
Sorts the elements in the entire xtd::basic_array <type_t> using the specified comparer.
Definition basic_array.hpp:410
static const comparer< xtd::any_object > default_comparer
Definition comparer.hpp:50
Provides a set of static methods for querying objects that implement ienumerable <type_t>.
Definition enumerable.hpp:32
internal_base_type base_type
Underlying vector type.
Definition raw_array.hpp:123
std::reverse_iterator< const_iterator > const_reverse_iterator
Const reverse iterator.
Definition raw_array.hpp:135
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator.
Definition raw_array.hpp:134
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
typename xtd::collections::generic::extensions::enumerable_iterators< xtd::any_object, xtd::collections::generic::ienumerable< xtd::any_object > >::const_iterator const_iterator
Definition ienumerable.hpp:50
typename xtd::collections::generic::extensions::enumerable_iterators< xtd::any_object, xtd::collections::generic::ienumerable< xtd::any_object > >::iterator iterator
Definition ienumerable.hpp:48
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
Represents a collection of objects that can be individually accessed by index.
Definition ilist.hpp:43
static constexpr xtd::usize npos
Represents a value that is not a valid position in a collection.
Definition ilist.hpp:56
virtual auto clear() -> void=0
Removes all items from the xtd::collections::generic::icollection <type_t>.
virtual auto count() const noexcept -> xtd::usize=0
Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
virtual auto to_string() const -> xtd::string
Returns a xtd::string that represents the current object.
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.hpp:115
xtd::delegate< int32(type_t x, type_t y)> comparison
Represents the method that compares two objects of the same type.
Definition comparison.hpp:33
std::allocator< type_t > allocator
Represent an allocator alias.
Definition allocator.hpp:38
@ 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
@ out_of_memory
Out of memory.
Definition exception_case.hpp:87
@ argument_null
The argument is null.
Definition exception_case.hpp:33
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
@ invalid_operation
The operation is not valid.
Definition exception_case.hpp:65
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
constexpr auto npos
Represents a value that is not a valid position in a collection.
Definition npos.hpp:26
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
null_ptr null
Represents a null pointer value.
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
std::ptrdiff_t ptrdiff
Represent the signed integer type of the result of subtracting two pointers.
Definition ptrdiff.hpp:23
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
auto new_ptr(args_t &&... args) -> xtd::ptr< type_t >
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
@ other
The operating system is other.
Definition platform_id.hpp:60
@ y
The Y key.
Definition console_key.hpp:136
@ i
The I key.
Definition console_key.hpp:104
@ x
The X key.
Definition console_key.hpp:134
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
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:249
xtd::usize size_type
Represents the read_only_span size type (usually xtd::usize).
Definition read_only_span.hpp:59
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:274
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:39
Implements a function object for compare data.
Definition lesser.hpp:39
Represents a value_type struct.
Definition value_type.hpp:34