9#define __XTD_CORE_INTERNAL__
11#undef __XTD_CORE_INTERNAL__
79 template<
class type_t,
class allocator_t>
80 class list :
public xtd::object,
public xtd::collections::generic::ilist<type_t>,
public xtd::iequatable<xtd::collections::generic::list<type_t, allocator_t>> {
83 bool operator()(
const type_t& e1,
const type_t& e2)
const {
return comparer_.compare(e1, e2) < 0;}
87 struct __comparison_comparer__ {
89 bool operator()(
const type_t& e1,
const type_t& e2)
const {
return comparison_(e1, e2) < 0;}
93 struct __enumerator__ :
public ienumerator<type_t> {
97 const type_t& current()
const override {
99 if (index_ < items_.
count())
return items_[index_];
100 static thread_local auto default_value =
value_type {};
101 return default_value;
104 bool move_next()
override {
106 return ++index_ < items_.
count();
109 void reset()
override {
110 version_ = items_.data_->version;
160 inline static constexpr size_type npos = xtd::collections::generic::ilist<type_t>::npos;
193 template<
class input_iterator_t>
307 if (value <
capacity()) shrink_to_fit();
363 virtual bool empty() const noexcept {
return data_->items.empty();}
480 void add(
const type_t& item)
override {push_back(item);}
494 void add(type_t&& item) {push_back(std::move(item));}
517 template<
class enumerable_t>
532 data_->items.assign(
count, value);
539 template<
class input_iterator_t>
549 data_->items.assign(
items.begin(),
items.end());
558 return reinterpret_cast<reference>(data_->items.at(index));
613 auto first = data_->items.begin();
614 auto last = data_->items.begin();
615 std::advance(
first, index);
619 if (position != data_->items.end() && !
comparer.
compare(item, *position))
620 return std::distance(data_->items.begin(), position);
621 return ~std::distance(data_->items.begin(), position);
630 data_->items.clear();
636 bool contains(
const type_t& value)
const noexcept override {
637 for (
const auto& item : data_->items)
636 bool contains(
const type_t& value)
const noexcept override {
…}
649 template<
class output_t>
652 for (
const auto& item : *
this)
693 for (
const type_t& item : *
this) {
694 if (
i >= index +
count)
return;
696 array[array_index +
c] = item;
709 template<
class ...args_t>
712 return to_type_iterator(data_->items.emplace(to_base_type_iterator(pos), std::forward<args_t>(args)...));
719 template<
class ...args_t>
722 return data_->items.emplace_back(std::forward<args_t>(args)...);
734 bool equals(
const list& rhs)
const noexcept override {
735 if (
count() != rhs.count())
return false;
738 return data_->version == rhs.data_->version;
750 return to_type_iterator(data_->items.erase(to_base_type_iterator(pos)));
762 return to_type_iterator(data_->items.erase(to_base_type_iterator(
first), to_base_type_iterator(
last)));
777 for (
const auto& item : *
this)
778 if (match(item))
return true;
794 for (
const auto& item : *
this)
795 if (match(item))
return item;
812 for (
const auto& item : *
this)
813 if (match(item)) result.add(item);
841 for (
auto index = start_index; index < start_index +
count; ++index)
842 if (match((*
this)[index]))
return index;
887 auto end_index = start_index -
count;
888 for (
auto index = start_index; index > end_index; --index)
889 if (match((*
this)[index]))
return index;
902 for (
const auto& item : *
this)
908 virtual allocator_type get_allocator()
const {
return data_->items.get_allocator();}
913 virtual base_type& get_base_type() noexcept {
return data_->items;}
916 virtual const base_type& get_base_type() const noexcept {
return data_->items;}
967 for (
auto i = index;
i < index +
count; ++
i)
980 return to_type_iterator(data_->items.insert(to_base_type_iterator(pos), value));
990 return to_type_iterator(data_->items.insert(to_base_type_iterator(pos), std::move(value)));
1001 return to_type_iterator(data_->items.insert(to_base_type_iterator(pos),
count, value));
1012 return to_type_iterator(data_->items.insert(to_base_type_iterator(pos),
count, std::move(value)));
1021 template<
class input_iterator_t>
1024 return to_type_iterator(data_->items.insert(to_base_type_iterator(pos),
first,
last));
1034 return to_type_iterator(data_->items.insert(to_base_type_iterator(pos),
items.begin(),
items.end()));
1093 template<
class ienumerable_t>
1104 insert(
begin() + index, enumerable.begin(), enumerable.end());
1134 for (
auto i = index;
i >= index - (
count - 1); --
i)
1135 if (value == data_->items[
i])
return i;
1143 virtual void pop_back() {
1145 data_->items.pop_back();
1152 virtual void push_back(
const type_t& value) {
1154 data_->items.push_back(value);
1160 virtual void push_back(type_t&& value) {
1162 data_->items.push_back(std::move(value));
1170 bool remove(
const type_t& item)
override {
1171 if (
count() == 0)
return false;
1173 if (!helpers::equator<type_t> {}(
at(index), item))
continue;
1193 auto iterator = data_->items.begin();
1194 while (
iterator != data_->items.end())
1201 if (
count) ++data_->version;
1208 void remove_at(
size_type index)
override {
1211 if (index ==
count() - 1) pop_back();
1212 else erase(
begin() + index);
1234 virtual void reserve(
size_type new_cap) {data_->items.reserve(new_cap);}
1250 data_->items.resize(
count, value);
1259 void reverse() {reverse(0,
count());}
1273 auto poitions1 = index;
1274 auto position2 = (index +
count) - 1;
1275 auto iterator1 = data_->items.begin() + poitions1;
1276 auto iterator2 = data_->items.begin() + position2;
1278 while (poitions1++ < position2--)
1279 std::iter_swap(iterator1++, iterator2--);
1285 virtual void shrink_to_fit() {data_->items.shrink_to_fit();}
1315 std::sort(data_->items.begin(), data_->items.end(), __comparison_comparer__ {comparison});
1324 void sort(
const xtd::collections::generic::icomparer<type_t>&
comparer) {
1338 auto first = data_->items.begin();
1339 auto last = data_->items.begin();
1340 std::advance(
first, index);
1348 virtual void swap(
list&
other)
noexcept {
1350 data_->items.swap(
other.data_->items);
1364 string to_string() const noexcept
override {
return xtd::string::format(
"[{}]", xtd::string::join(
", ", *
this));}
1386 virtual void trim_excess() {shrink_to_fit();}
1400 for (
const auto& item : *
this)
1401 if (!match(item))
return false;
1417 data_->version = std::move(
other.data_->version);
1418 data_->items = std::move(
other.data_->items);
1424 list& operator =(std::initializer_list<type_t>& items) {
1426 data_->items = items;
1434 const_reference operator [](size_type index)
const override {
return at(index);}
1439 reference operator [](size_type index)
override {
return at(index);}
1443 operator const base_type&()
const noexcept {
return data_->items;}
1450 typename base_type::const_iterator to_base_type_iterator(const_iterator value)
const noexcept {
1451 return ilist<type_t>::to_iterator(value, *
this, data_->items);
1454 typename base_type::iterator to_base_type_iterator(iterator value)
noexcept {
1458 const_iterator to_type_iterator(
typename base_type::const_iterator value)
const noexcept {
1459 return ilist<type_t>::to_iterator(value, data_->items, *
this);
1462 iterator to_type_iterator(
typename base_type::iterator value)
noexcept {
1463 return ilist<type_t>::to_iterator(value, data_->items, *
this);
1467 list_data() =
default;
1468 explicit list_data(
const allocator_type& alloc) noexcept : items(alloc) {}
1469 list_data(size_type count,
const type_t& value,
const allocator_type& alloc = allocator_type()) : items(count, value, alloc) {}
1470 explicit list_data(size_type count,
const allocator_type& alloc = allocator_type()) : items(count, alloc) {}
1471 template<
class input_iterator_t>
1472 list_data(input_iterator_t first, input_iterator_t last,
const allocator_type& alloc = allocator_type()) : items(
first,
last, alloc) {}
1473 list_data(
const xtd::collections::generic::ienumerable<type_t>& collection,
const allocator_type& alloc = allocator_type()) : items(collection.
begin(), collection.
end(), alloc) {}
1474 list_data(
const list& list) : items(list.data_->items), version(list.data_->version) {}
1475 list_data(
const base_type& list) : items(list) {}
1476 list_data(
const list& list,
const allocator_type& alloc) : items(list.data_->items, alloc), version(list.data_->version) {}
1477 list_data(
const base_type& list,
const allocator_type& alloc) : items(list, alloc) {}
1478 list_data(std::initializer_list<type_t> items,
const allocator_type& alloc = allocator_type()) : items(items.
begin(), items.
end(), alloc) {}
1479 list_data(list&& other) : items(std::move(
other.data_->items)), version(std::move(
other.data_->version)) {
other.data_->items.clear();
other.data_->version = 0;}
1480 list_data(base_type&& other) : items(std::move(
other)) {
other.clear();}
1481 list_data(list&& other,
const allocator_type& alloc) : items(
other.data_->items, alloc), version{std::move(
other.data_->version)} {
other.data_->items.clear();
other.data_->version = 0;}
1482 list_data(base_type&& other,
const allocator_type& alloc) : items(std::move(
other), alloc) {}
1484 list_data(
const list_data&) =
default;
1485 list_data& operator =(
const list_data&) =
default;
1489 xtd::object sync_root;
80 class list :
public xtd::object,
public xtd::collections::generic::ilist<type_t>,
public xtd::iequatable<xtd::collections::generic::list<type_t, allocator_t>> {
…};
1498 template<
class type_t>
1499 list(std::initializer_list<type_t>) -> list<type_t, helpers::allocator<type_to_list_t<type_t>>>;
1501 template<
class type_t>
1502 list(
const ienumerable<type_t>&) -> list<type_t, helpers::allocator<type_to_list_t<type_t>>>;
1504 template<
class type_t>
1505 list(
const ilist<type_t>&) -> list<type_t, helpers::allocator<type_to_list_t<type_t>>>;
1507 template<
class type_t>
1508 list(
const std::vector<type_t>&) -> list<type_t, helpers::allocator<type_to_list_t<type_t>>>;
1510 template<
class type_t,
class allocator_t = helpers::allocator<type_to_list_t<type_t>>>
1511 list(
const list<type_t, allocator_t>&) -> list<type_t, allocator_t>;
1513 template<
class type_t>
1514 list(std::vector<type_t>&&) -> list<type_t, helpers::allocator<type_to_list_t<type_t>>>;
1516 template<
class type_t,
class allocator_t = helpers::allocator<type_to_list_t<type_t>>>
1517 list(list<type_t, allocator_t>&&) -> list<type_t, allocator_t>;
1526 template <
class enumerable_t,
class source_t>
1533 template <
class source_t>
1534 inline const xtd::collections::generic::list<source_t>&
enumerable::to_list(
const xtd::collections::generic::ienumerable<source_t>& source)
noexcept {
1535 static thread_local auto result = xtd::collections::generic::list<source_t> {};
1536 result = xtd::collections::generic::list<source_t> {source};
Contains xtd::collections::generic::list definitions.
Contains xtd::action delegate.
Contains xtd::collections::generic::helpers::allocator alias.
Contains xtd::argument_exception exception.
Contains xtd::argument_out_of_range_exception exception.
Contains xtd::box_integer class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
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:229
Provides a base class for implementations of the xtd::collections::generic::icomparer <type_t> generi...
Definition comparer.hpp:33
result_type compare(const first_argument_type &x, const second_argument_type &y) const noexcept override
Compares two entities and returns a value indicating whether one is less than, equal to,...
Definition comparer.hpp:66
static const comparer< xtd::any_object > default_comparer
Definition comparer.hpp:50
virtual const_iterator end() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:170
virtual const_iterator begin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:155
virtual const_iterator cbegin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:162
virtual const_iterator cend() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:166
const list< source_t > & to_list() const noexcept
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <ty...
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:36
typename xtd::collections::generic::extensions::enumerable_iterators< xtd::any_object, xtd::collections::generic::ienumerable< xtd::any_object > >::const_iterator const_iterator
Definition ienumerable.hpp:46
typename xtd::collections::generic::extensions::enumerable_iterators< xtd::any_object, xtd::collections::generic::ienumerable< xtd::any_object > >::iterator iterator
Definition ienumerable.hpp:44
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
void insert(size_type index, const type_t &value) override
Inserts an element into the xtd::collections::generic::list <type_t> at the specified index.
Definition list.hpp:1042
bool is_read_only() const noexcept override
Gets a value indicating whether the xtd::collections::generic::list <type_t> is read-only.
Definition list.hpp:389
virtual pointer data() noexcept
Returns pointer to the underlying array serving as element storage.
Definition list.hpp:355
void add(const type_t &item) override
Adds an object to the end of the xtd::collections::generic::list <type_t>.
Definition list.hpp:480
virtual reference at(size_type index)
Returns a reference to the element at specified location pos, with bounds checking.
Definition list.hpp:556
list(base_type &&other)
Move constructor with specified base type list.
Definition list.hpp:229
const_iterator begin() const noexcept override
Returns an iterator to the first element of the enumarable.
Definition list.hpp:254
virtual const_reference at(size_type index) const
Returns a reference to the element at specified location pos, with bounds checking.
Definition list.hpp:564
xtd::size binary_search(const type_t &item) const
Searches the entire sorted xtd::collections::generic::list <type_t> for an element using the default ...
Definition list.hpp:582
xtd::size binary_search(const type_t &item, const xtd::collections::generic::icomparer< type_t > &comparer) const
Searches the entire sorted xtd::collections::generic::list <type_t> for an element using the specifie...
Definition list.hpp:595
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
Definition list.hpp:733
virtual const_reverse_iterator crend() const noexcept
Returns a reverse iterator to the element following the last element of the reversed vector....
Definition list.hpp:350
virtual const_base_type & items() const noexcept
Returns the underlying base type items.
Definition list.hpp:409
typename xtd::collections::generic::ienumerable< xtd::any_object >::iterator iterator
Definition list.hpp:145
virtual size_type max_size() const noexcept
Returns the maximum number of elements the container is able to hold due to system or library impleme...
Definition list.hpp:416
virtual void copy_to(size_type index, xtd::array< type_t > &array, size_type array_index, size_type count) const
Copies the entire xtd::collections::generic::list <type_t> to a compatible one-dimensional array,...
Definition list.hpp:690
virtual reference front()
Returns a reference to the first element in the container.
Definition list.hpp:375
list< output_t > convert_all(xtd::converter< output_t, const type_t & > converter) const
Converts the elements in the current xtd::colllections::generic::list <type_t> to another type,...
Definition list.hpp:650
const value_type * const_pointer
Definition list.hpp:143
const base_type const_base_type
Definition list.hpp:131
const xtd::object & sync_root() const noexcept override
Gets an object that can be used to synchronize access to the the xtd::collections::generic::list <typ...
Definition list.hpp:461
static constexpr size_type npos
This is a special value equal to the maximum value representable by the type size_type.
Definition list.hpp:160
list(std::initializer_list< type_t > items, const allocator_type &alloc=allocator_type())
Constructs the container with the contents of the specified initializer list, and allocator.
Definition list.hpp:222
const_iterator end() const noexcept override
Returns an iterator to the element following the last element of the enumarable.
Definition list.hpp:367
virtual void insert_range(size_type index, const xtd::collections::generic::ienumerable< type_t > &enumerable)
Inserts copy of elements from a collection into the xtd::collections::generic::list <type_t> at the s...
Definition list.hpp:1065
void assign(size_type count, const type_t &value)
Replaces the contents with count copies of value value.
Definition list.hpp:530
virtual reverse_iterator rend() noexcept
Returns a reverse iterator to the element following the last element of the reversed vector....
Definition list.hpp:430
const_iterator cbegin() const noexcept override
Returns an iterator to the first element of the enumarable.
Definition list.hpp:313
void assign(input_iterator_t first, input_iterator_t last)
Replaces the contents with copies of those in the range [first, last).
Definition list.hpp:540
typename base_type::reverse_iterator reverse_iterator
Definition list.hpp:149
list(list &&other, const allocator_type &alloc)
Move constructor with specified list, and allocator.
Definition list.hpp:233
void copy_to(xtd::array< type_t > &array, size_type array_index) const override
Copies the entire xtd::colllections::generic::list <type_t> to a compatible one-dimensional array,...
Definition list.hpp:675
virtual void copy_to(xtd::array< type_t > &array) const
Copies the entire xtd::collections::generic::list <type_t> to a compatible one-dimensional array.
Definition list.hpp:667
list(input_iterator_t first, input_iterator_t last, const allocator_type &alloc=allocator_type())
Constructs the container with the contents of the range [first, last).
Definition list.hpp:194
typename xtd::collections::generic::ienumerable< xtd::any_object >::const_iterator const_iterator
Definition list.hpp:147
virtual const_pointer data() const noexcept
Returns pointer to the underlying array serving as element storage.
Definition list.hpp:359
void clear() override
Removes all elements from the xtd::collections::generic::list <type_t>.
Definition list.hpp:628
virtual base_type & items() noexcept
Returns the underlying base type items.
Definition list.hpp:412
virtual bool empty() const noexcept
Checks if the container has no elements, i.e. whether xtd::collections::generic::list::begin() == xtd...
Definition list.hpp:363
virtual const_reference front() const
Returns a reference to the first element in the container.
Definition list.hpp:379
void insert(size_type index, type_t &&value)
Inserts an element into the xtd::collections::generic::list <type_t> at the specified index.
Definition list.hpp:1051
reference emplace_back(args_t &&... args)
Appends a new element to the end of the container. The element is constructed through std::allocator_...
Definition list.hpp:720
size_type last_index_of(const type_t &value) const
Determines the last index of a specific item in the xtd::collections::generic::list <type_t>.
Definition list.hpp:1111
typename xtd::collections::generic::helpers::allocator< typename std::conditional< std::is_same< bool, value_type >::value, xtd::byte, value_type >::type > allocator_type
Definition list.hpp:127
bool is_synchronized() const noexcept override
Gets a value indicating whether access to the xtd::collections::generic::list <type_t> is synchronize...
Definition list.hpp:405
list(const list &list)
Default copy constructor with specified list.
Definition list.hpp:207
xtd::ptrdiff difference_type
Definition list.hpp:135
list(const xtd::collections::generic::ienumerable< type_t > &collection, const allocator_type &alloc=allocator_type())
Initializes a new instance of the xtd::collections::generic::list <type_t> class that contains elemen...
Definition list.hpp:203
xtd::size binary_search(xtd::size index, xtd::size count, const type_t &item, const xtd::collections::generic::icomparer< type_t > &comparer) const
Searches a range of elements in the sorted xtd::collections::generic::list <type_t> for an element us...
Definition list.hpp:611
list() noexcept=default
Initializes a new instance of the xtd::collections::generic::list class that is empty.
virtual const_reference back() const
Returns a reference to the last element in the container.
Definition list.hpp:250
list(const base_type &list, const allocator_type &alloc)
Default copy constructor with specified base type list, and allocator.
Definition list.hpp:218
list(const list &list, const allocator_type &alloc)
Default copy constructor with specified list, and allocator.
Definition list.hpp:214
bool is_fixed_size() const noexcept override
Gets a value indicating whether the xtd::collections::generic::list <type_t> has a fixed size.
Definition list.hpp:384
xtd::size size_type
Definition list.hpp:133
virtual iterator insert(const_iterator pos, size_type count, type_t &&value)
Inserts elements at the specified location in the container.
Definition list.hpp:1010
const value_type & const_reference
Definition list.hpp:139
iterator end() noexcept override
Returns an iterator to the element following the last element of the enumarable.
Definition list.hpp:370
virtual size_type capacity() const noexcept
Gets the total number of elements the internal data structure can hold without resizing.
Definition list.hpp:281
virtual void assign(std::initializer_list< type_t > items)
Replaces the contents with the elements from the initializer list items.
Definition list.hpp:547
xtd::size ensure_capacity(xtd::size capacity)
Ensures that the capacity of this list is at least the specified capacity. If the current capacity is...
Definition list.hpp:728
std::vector< typename std::conditional< std::is_same< bool, value_type >::value, xtd::byte, value_type >::type, allocator_type > base_type
Definition list.hpp:129
virtual const_reverse_iterator crbegin() const noexcept
Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last el...
Definition list.hpp:345
size_type count() const noexcept override
Gets the number of elements contained in the xtd::collections::generic::list <type_t>.
Definition list.hpp:340
list(size_type count, const type_t &value, const allocator_type &alloc=allocator_type())
Constructs the container with specified count copies of elements with specified value.
Definition list.hpp:184
list(list &&other)
Move constructor with specified list.
Definition list.hpp:226
typename base_type::const_reverse_iterator const_reverse_iterator
Definition list.hpp:151
virtual const_reverse_iterator rend() const noexcept
Returns a reverse iterator to the element following the last element of the reversed vector....
Definition list.hpp:434
value_type & reference
Definition list.hpp:137
virtual void insert_range(size_type index, const std::initializer_list< type_t > &items)
Inserts copy of elements from a collection into the xtd::collections::generic::list <type_t> at the s...
Definition list.hpp:1087
void add_range(const xtd::collections::generic::ienumerable< type_t > &enumerable)
Adds copy of elements from the specified collection to the end of the xtd::collections::generic::list...
Definition list.hpp:504
read_only_collection as_read_only() const noexcept
Returns a read-only xtd::collections::object_model::read_only_collection <type_t> wrapper for the cur...
Definition list.hpp:525
virtual reverse_iterator rbegin() noexcept
Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last el...
Definition list.hpp:421
void add(type_t &&item)
Adds an object to the end of the xtd::collections::generic::list <type_t>.
Definition list.hpp:494
iterator begin() noexcept override
Returns an iterator to the first element of the enumarable.
Definition list.hpp:257
virtual void capacity(size_type value)
Sets the total number of elements the internal data structure can hold without resizing.
Definition list.hpp:304
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::collections::generic::list::...
Definition list.hpp:438
virtual iterator insert(const_iterator pos, const type_t &value)
Inserts elements at the specified location in the container.
Definition list.hpp:978
virtual void resize(size_type count)
Determines the last index of a specific item in the xtd::collections::generic::list <type_t>.
Definition list.hpp:1240
list(const base_type &list)
Copy constructor with specified base type list.
Definition list.hpp:210
virtual const_reverse_iterator rbegin() const noexcept
Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last el...
Definition list.hpp:425
list(base_type &&other, const allocator_type &alloc)
Move constructor with specified base tyoe list, and allocator.
Definition list.hpp:237
void add_range(std::initializer_list< type_t > il)
Adds copy of elements from the specified collection to the end of the xtd::collections::generic::list...
Definition list.hpp:514
value_type * pointer
Definition list.hpp:141
const_iterator cend() const noexcept override
Returns an iterator to the element following the last element of the enumarable.
Definition list.hpp:317
virtual iterator insert(const_iterator pos, const std::initializer_list< type_t > &items)
Inserts elements at the specified location in the container.
Definition list.hpp:1032
xtd::collections::object_model::read_only_collection< value_type > read_only_collection
Definition list.hpp:153
bool contains(const type_t &value) const noexcept override
Determines whether an element is in the xtd::colllections::generic::list <type_t>.
Definition list.hpp:636
type_t value_type
Represents the list value type.
Definition list.hpp:125
virtual size_type index_of(const type_t &value, size_type index, size_type count) const
Erases the specified elements from the container.
Definition list.hpp:963
iterator insert(const_iterator pos, input_iterator_t first, input_iterator_t last)
Inserts elements at the specified location in the container.
Definition list.hpp:1022
iterator emplace(const_iterator pos, args_t &&... args)
Inserts a new element into the container directly before pos.
Definition list.hpp:710
list(size_type count, const allocator_type &alloc=allocator_type())
Constructs the container with specified count default-inserted instances of type_t....
Definition list.hpp:188
virtual iterator insert(const_iterator pos, size_type count, const type_t &value)
Inserts elements at the specified location in the container.
Definition list.hpp:999
virtual iterator insert(const_iterator pos, const type_t &&value)
Inserts elements at the specified location in the container.
Definition list.hpp:988
virtual reference back()
Returns a reference to the last element in the container.
Definition list.hpp:246
Provides the base class for a generic read-only collection.
Definition read_only_collection.hpp:38
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
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:22
static const list< source_t > & to_list(const ienumerable< source_t > &source) noexcept
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <ty...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.hpp:114
Contains xtd::comparison delegate.
Contains xtd::converter alias.
Contains xtd::collections::generic::helpers::equator struct.
Contains xtd::collections::generic::comparer <type_t> class.
Contains xtd::collections::generic::ilist <type_t> interface.
generic::enumerator< xtd::any_object > enumerator
Supports a simple iteration over a non-generic collection.
Definition enumerator.hpp:28
generic::ilist< xtd::any_object > ilist
Represents a non-generic collection of objects that can be individually accessed by index.
Definition ilist.hpp:32
xtd::collections::generic::comparer< xtd::any_object > comparer
Exposes a method that compares two objects.
Definition comparer.hpp:25
generic::ienumerable< xtd::any_object > ienumerable
Exposes an enumerator, which supports a simple iteration over a non-generic collection.
Definition ienumerable.hpp:32
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
xtd::delegate< output_t(input_t input)> converter
Represents a method that converts an object from one type to another type.
Definition converter.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:59
@ 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:63
std::type_info type
Stores information about a type.
Definition type.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
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
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
xtd::func< bool, type_t > predicate
Represents a delegate that defines a set of criteria and determines whether the specified object meet...
Definition predicate.hpp:16
bool is(std::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:365
delegate< void(arguments_t...)> action
Represents a xtd::delegate that has variable parameters and does not return a value.
Definition action.hpp:20
@ start
Starting of a logical operation.
Definition trace_event_type.hpp:37
@ other
The operating system is other.
Definition platform_id.hpp:58
@ c
The C key.
Definition console_key.hpp:92
@ i
The I key.
Definition console_key.hpp:104
@ insert
The INS (INSERT) key.
Definition console_key.hpp:62
Contains xtd::index_out_of_range_exception exception.
Contains xtd::intptr type.
Contains xtd::invalid_operation_exception exception.
The xtd::extensions namespace contains interface extensions.
Definition collection_operators.hpp:13
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
virtual bool remove(const type_t &item)=0
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
Provides classes and interfaces that support queries that use Language-Integrated Query (LINQ).
Definition enumerable.hpp:41
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
const_iterator begin() const
Returns an iterator to the beginning.
Definition read_only_span.hpp:183
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375
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
const_iterator end() const
Returns an iterator to the end.
Definition read_only_span.hpp:213
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
const_reference at(size_type pos) const
Gets the specified element with bounds checking.
Definition read_only_span.hpp:255
read_only_span< type_t > slice() const
Forms a slice out of the current read_only_span starting at a specified index for a specified length.
Definition read_only_span.hpp:325
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
xtd::array< std::remove_cv_t< type_t > > to_array() const noexcept
Copies the contents of this read_only_span into a new array.
Definition read_only_span.hpp:368
Contains xtd::new_ptr method.
Contains xtd::object class.
Contains xtd::predicate delegate.
Contains xtd::collections::object_model::read_only_collection class.
Contains xtd::string alias.
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:38