9#define __XTD_CORE_INTERNAL__
11#undef __XTD_CORE_INTERNAL__
78 template<
class type_t,
class allocator_t>
79 class list :
public xtd::object,
public xtd::collections::generic::ilist<type_t>,
public xtd::iequatable<xtd::collections::generic::list<type_t, allocator_t >> {
82 bool operator()(
const type_t& e1,
const type_t& e2)
const {
return comparer_.compare(e1, e2) < 0;}
86 struct __comparison_comparer__ {
88 bool operator()(
const type_t& e1,
const type_t& e2)
const {
return comparison_(e1, e2) < 0;}
92 struct __enumerator__ :
public ienumerator<type_t> {
96 const type_t& current()
const override {
98 if (index_ < items_.
count())
return items_[index_];
99 static thread_local auto default_value =
value_type {};
100 return default_value;
103 bool move_next()
override {
105 return ++index_ < items_.
count();
108 void reset()
override {
109 version_ = items_.data_->version;
159 inline static constexpr size_type npos = xtd::collections::generic::ilist<type_t>::npos;
192 template<
class input_iterator_t>
306 if (value <
capacity()) shrink_to_fit();
362 virtual bool empty() const noexcept {
return data_->items.empty();}
479 void add(
const type_t& item)
override {push_back(item);}
493 void add(type_t&& item) {push_back(std::move(item));}
516 template<
class enumerable_t>
531 data_->items.assign(
count, value);
538 template<
class input_iterator_t>
548 data_->items.assign(
items.begin(),
items.end());
557 return reinterpret_cast<reference>(data_->items.at(index));
612 auto first = data_->items.begin();
613 auto last = data_->items.begin();
614 std::advance(
first, index);
618 if (position != data_->items.end() && !
comparer.
compare(item, *position))
619 return std::distance(data_->items.begin(), position);
620 return ~std::distance(data_->items.begin(), position);
629 data_->items.clear();
635 bool contains(
const type_t& value)
const noexcept override {
636 for (
const auto& item : data_->items)
635 bool contains(
const type_t& value)
const noexcept override {
…}
648 template<
class output_t>
651 for (
const auto& item : *
this)
692 for (
const type_t& item : *
this) {
693 if (
i >= index +
count)
return;
695 array[array_index +
c] = item;
708 template<
class ...args_t>
711 return to_type_iterator(data_->items.emplace(to_const_base_type_iterator(pos), std::forward<args_t>(args)...));
718 template<
class ...args_t>
721 return data_->items.emplace_back(std::forward<args_t>(args)...);
733 bool equals(
const list& rhs)
const noexcept override {
734 if (
count() != rhs.count())
return false;
737 return data_->version == rhs.data_->version;
749 return to_type_iterator(data_->items.erase(to_const_base_type_iterator(pos)));
761 return to_type_iterator(data_->items.erase(to_const_base_type_iterator(
first), to_const_base_type_iterator(
last)));
776 for (
const auto& item : *
this)
777 if (match(item))
return true;
793 for (
const auto& item : *
this)
794 if (match(item))
return item;
811 for (
const auto& item : *
this)
812 if (match(item)) result.add(item);
840 for (
auto index = start_index; index < start_index +
count; ++index)
841 if (match((*
this)[index]))
return index;
886 auto end_index = start_index -
count;
887 for (
auto index = start_index; index > end_index; --index)
888 if (match((*
this)[index]))
return index;
901 for (
const auto& item : *
this)
907 virtual allocator_type get_allocator()
const {
return data_->items.get_allocator();}
912 virtual base_type& get_base_type() noexcept {
return data_->items;}
915 virtual const base_type& get_base_type() const noexcept {
return data_->items;}
966 for (
auto i = index;
i < index +
count; ++
i)
979 return to_type_iterator(data_->items.insert(to_const_base_type_iterator(pos), value));
989 return to_type_iterator(data_->items.insert(to_const_base_type_iterator(pos), std::move(value)));
1000 return to_type_iterator(data_->items.insert(to_const_base_type_iterator(pos),
count, value));
1011 return to_type_iterator(data_->items.insert(to_const_base_type_iterator(pos),
count, std::move(value)));
1020 template<
class input_iterator_t>
1023 return to_type_iterator(data_->items.insert(to_const_base_type_iterator(pos),
first,
last));
1033 return to_type_iterator(data_->items.insert(to_const_base_type_iterator(pos),
items.begin(),
items.end()));
1092 template<
class ienumerable_t>
1103 insert(
begin() + index, enumerable.begin(), enumerable.end());
1133 for (
auto i = index;
i >= index - (
count - 1); --
i)
1134 if (value == data_->items[
i])
return i;
1142 virtual void pop_back() {
1144 data_->items.pop_back();
1151 virtual void push_back(
const type_t& value) {
1153 data_->items.push_back(value);
1159 virtual void push_back(type_t&& value) {
1161 data_->items.push_back(std::move(value));
1169 bool remove(
const type_t& item)
override {
1170 if (
count() == 0)
return false;
1172 if (!helpers::equator<type_t> {}(
at(index), item))
continue;
1192 auto iterator = data_->items.begin();
1193 while (
iterator != data_->items.end())
1200 if (
count) ++data_->version;
1207 void remove_at(
size_type index)
override {
1210 if (index ==
count() - 1) pop_back();
1211 else erase(
begin() + index);
1233 virtual void reserve(
size_type new_cap) {data_->items.reserve(new_cap);}
1249 data_->items.resize(
count, value);
1258 void reverse() {reverse(0,
count());}
1272 auto poitions1 = index;
1273 auto position2 = (index +
count) - 1;
1274 auto iterator1 = data_->items.begin() + poitions1;
1275 auto iterator2 = data_->items.begin() + position2;
1277 while (poitions1++ < position2--)
1278 std::iter_swap(iterator1++, iterator2--);
1284 virtual void shrink_to_fit() {data_->items.shrink_to_fit();}
1314 std::sort(data_->items.begin(), data_->items.end(), __comparison_comparer__ {comparison});
1323 void sort(
const xtd::collections::generic::icomparer<type_t>&
comparer) {
1337 auto first = data_->items.begin();
1338 auto last = data_->items.begin();
1339 std::advance(
first, index);
1347 virtual void swap(
list&
other)
noexcept {
1349 data_->items.swap(
other.data_->items);
1363 string to_string() const noexcept
override {
return xtd::string::format(
"[{}]", xtd::string::join(
", ", *
this));}
1385 virtual void trim_excess() {shrink_to_fit();}
1399 for (
const auto& item : *
this)
1400 if (!match(item))
return false;
1416 data_->version = std::move(
other.data_->version);
1417 data_->items = std::move(
other.data_->items);
1423 list& operator =(std::initializer_list<type_t>& items) {
1425 data_->items = items;
1433 const_reference operator [](size_type index)
const override {
return at(index);}
1438 reference operator [](size_type index)
override {
return at(index);}
1442 operator const base_type& ()
const noexcept {
return data_->items;}
1449 typename base_type::const_iterator to_const_base_type_iterator(const_iterator value)
const noexcept {
1450 return ilist<type_t>::to_const_iterator(value, *
this, data_->items);
1453 const_iterator to_const_type_iterator(
typename base_type::const_iterator value)
const noexcept {
1457 typename base_type::const_iterator to_base_type_iterator(const_iterator value)
const noexcept {
1458 return ilist<type_t>::to_iterator(value, *
this, data_->items);
1461 typename base_type::iterator to_base_type_iterator(iterator value)
noexcept {
1462 return ilist<type_t>::to_iterator(value, *
this, data_->items);
1465 const_iterator to_type_iterator(
typename base_type::const_iterator value)
const noexcept {
1466 return ilist<type_t>::to_iterator(value, data_->items, *
this);
1469 iterator to_type_iterator(
typename base_type::iterator value)
noexcept {
1470 return ilist<type_t>::to_iterator(value, data_->items, *
this);
1474 list_data() =
default;
1475 explicit list_data(
const allocator_type& alloc) noexcept : items(alloc) {}
1476 list_data(size_type count,
const type_t& value,
const allocator_type& alloc = allocator_type()) : items(count, value, alloc) {}
1477 explicit list_data(size_type count,
const allocator_type& alloc = allocator_type()) : items(count, alloc) {}
1478 template<
class input_iterator_t>
1479 list_data(input_iterator_t first, input_iterator_t last,
const allocator_type& alloc = allocator_type()) : items(
first,
last, alloc) {}
1480 list_data(
const xtd::collections::generic::ienumerable<type_t>& collection,
const allocator_type& alloc = allocator_type()) : items(collection.
begin(), collection.
end(), alloc) {}
1481 list_data(
const list& list) : items(list.data_->items), version(list.data_->version) {}
1482 list_data(
const base_type& list) : items(list) {}
1483 list_data(
const list& list,
const allocator_type& alloc) : items(list.data_->items, alloc), version(list.data_->version) {}
1484 list_data(
const base_type& list,
const allocator_type& alloc) : items(list, alloc) {}
1485 list_data(std::initializer_list<type_t> items,
const allocator_type& alloc = allocator_type()) : items(items.
begin(), items.
end(), alloc) {}
1486 list_data(list&& other) : items(std::move(
other.data_->items)), version(std::move(
other.data_->version)) {
other.data_->items.clear();
other.data_->version = 0;}
1487 list_data(base_type&& other) : items(std::move(
other)) {
other.clear();}
1488 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;}
1489 list_data(base_type&& other,
const allocator_type& alloc) : items(std::move(
other), alloc) {}
1491 list_data(
const list_data&) =
default;
1492 list_data& operator =(
const list_data&) =
default;
1496 xtd::object sync_root;
79 class list :
public xtd::object,
public xtd::collections::generic::ilist<type_t>,
public xtd::iequatable<xtd::collections::generic::list<type_t, allocator_t >> {
…};
1505 template<
class type_t>
1506 list(std::initializer_list<type_t>) -> list<type_t, helpers::allocator<type_to_list_t<type_t >>>;
1508 template<
class type_t>
1509 list(
const ienumerable<type_t>&) -> list<type_t, helpers::allocator<type_to_list_t<type_t >>>;
1511 template<
class type_t>
1512 list(
const ilist<type_t>&) -> list<type_t, helpers::allocator<type_to_list_t<type_t >>>;
1514 template<
class type_t>
1515 list(
const std::vector<type_t>&) -> list<type_t, helpers::allocator<type_to_list_t<type_t >>>;
1517 template<
class type_t,
class allocator_t = helpers::allocator<type_to_list_t<type_t>>>
1518 list(
const list<type_t, allocator_t>&) -> list<type_t, allocator_t>;
1520 template<
class type_t>
1521 list(std::vector<type_t>&&) -> list<type_t, helpers::allocator<type_to_list_t<type_t >>>;
1523 template<
class type_t,
class allocator_t = helpers::allocator<type_to_list_t<type_t>>>
1524 list(list<type_t, allocator_t>&&) -> list<type_t, allocator_t>;
1533 template <
class enumerable_t,
class source_t>
1540 template <
class source_t>
1541 inline auto enumerable::to_list(
const xtd::collections::generic::ienumerable<source_t>& source)
noexcept {
1542 auto result = xtd::collections::generic::list<source_t> {};
1543 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:246
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 cbegin() const
Returns an iterator to the first element of the enumerable.
Definition enumerable_iterators.hpp:148
virtual const_iterator begin() const
Returns an iterator to the first element of the enumerable.
Definition enumerable_iterators.hpp:141
virtual const_iterator cend() const
Returns an iterator to the element following the last element of the enumerable.
Definition enumerable_iterators.hpp:152
virtual const_iterator end() const
Returns an iterator to the element following the last element of the enumerable.
Definition enumerable_iterators.hpp:156
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:79
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:1041
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:388
virtual pointer data() noexcept
Returns pointer to the underlying array serving as element storage.
Definition list.hpp:354
void add(const type_t &item) override
Adds an object to the end of the xtd::collections::generic::list <type_t>.
Definition list.hpp:479
virtual reference at(size_type index)
Returns a reference to the element at specified location pos, with bounds checking.
Definition list.hpp:555
list(base_type &&other)
Move constructor with specified base type list.
Definition list.hpp:228
const_iterator begin() const noexcept override
Returns an iterator to the first element of the enumerable.
Definition list.hpp:253
virtual const_reference at(size_type index) const
Returns a reference to the element at specified location pos, with bounds checking.
Definition list.hpp:563
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:581
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:594
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
Definition list.hpp:732
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:349
virtual const_base_type & items() const noexcept
Returns the underlying base type items.
Definition list.hpp:408
typename xtd::collections::generic::ienumerable< xtd::any_object >::iterator iterator
Definition list.hpp:144
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:415
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:689
virtual reference front()
Returns a reference to the first element in the container.
Definition list.hpp:374
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:649
const value_type * const_pointer
Definition list.hpp:142
const base_type const_base_type
Definition list.hpp:130
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:460
static constexpr size_type npos
This is a special value equal to the maximum value representable by the type size_type.
Definition list.hpp:159
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:221
const_iterator end() const noexcept override
Returns an iterator to the element following the last element of the enumerable.
Definition list.hpp:366
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:1064
void assign(size_type count, const type_t &value)
Replaces the contents with count copies of value value.
Definition list.hpp:529
virtual reverse_iterator rend() noexcept
Returns a reverse iterator to the element following the last element of the reversed vector....
Definition list.hpp:429
const_iterator cbegin() const noexcept override
Returns an iterator to the first element of the enumerable.
Definition list.hpp:312
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:539
typename base_type::reverse_iterator reverse_iterator
Definition list.hpp:148
list(list &&other, const allocator_type &alloc)
Move constructor with specified list, and allocator.
Definition list.hpp:232
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:674
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:666
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:193
typename xtd::collections::generic::ienumerable< xtd::any_object >::const_iterator const_iterator
Definition list.hpp:146
virtual const_pointer data() const noexcept
Returns pointer to the underlying array serving as element storage.
Definition list.hpp:358
void clear() override
Removes all elements from the xtd::collections::generic::list <type_t>.
Definition list.hpp:627
virtual base_type & items() noexcept
Returns the underlying base type items.
Definition list.hpp:411
virtual bool empty() const noexcept
Checks if the container has no elements, i.e. whether xtd::collections::generic::list::begin() == xtd...
Definition list.hpp:362
virtual const_reference front() const
Returns a reference to the first element in the container.
Definition list.hpp:378
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:1050
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:719
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:1110
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:126
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:404
list(const list &list)
Default copy constructor with specified list.
Definition list.hpp:206
xtd::ptrdiff difference_type
Definition list.hpp:134
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:202
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:610
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:249
list(const base_type &list, const allocator_type &alloc)
Default copy constructor with specified base type list, and allocator.
Definition list.hpp:217
list(const list &list, const allocator_type &alloc)
Default copy constructor with specified list, and allocator.
Definition list.hpp:213
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:383
xtd::size size_type
Definition list.hpp:132
virtual iterator insert(const_iterator pos, size_type count, type_t &&value)
Inserts elements at the specified location in the container.
Definition list.hpp:1009
const value_type & const_reference
Definition list.hpp:138
iterator end() noexcept override
Returns an iterator to the element following the last element of the enumerable.
Definition list.hpp:369
virtual size_type capacity() const noexcept
Gets the total number of elements the internal data structure can hold without resizing.
Definition list.hpp:280
virtual void assign(std::initializer_list< type_t > items)
Replaces the contents with the elements from the initializer list items.
Definition list.hpp:546
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:727
std::vector< typename std::conditional< std::is_same< bool, value_type >::value, xtd::byte, value_type >::type, allocator_type > base_type
Definition list.hpp:128
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:344
size_type count() const noexcept override
Gets the number of elements contained in the xtd::collections::generic::list <type_t>.
Definition list.hpp:339
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:183
list(list &&other)
Move constructor with specified list.
Definition list.hpp:225
typename base_type::const_reverse_iterator const_reverse_iterator
Definition list.hpp:150
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:433
value_type & reference
Definition list.hpp:136
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:1086
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:503
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:524
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:420
void add(type_t &&item)
Adds an object to the end of the xtd::collections::generic::list <type_t>.
Definition list.hpp:493
iterator begin() noexcept override
Returns an iterator to the first element of the enumerable.
Definition list.hpp:256
virtual void capacity(size_type value)
Sets the total number of elements the internal data structure can hold without resizing.
Definition list.hpp:303
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:437
virtual iterator insert(const_iterator pos, const type_t &value)
Inserts elements at the specified location in the container.
Definition list.hpp:977
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:1239
list(const base_type &list)
Copy constructor with specified base type list.
Definition list.hpp:209
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:424
list(base_type &&other, const allocator_type &alloc)
Move constructor with specified base tyoe list, and allocator.
Definition list.hpp:236
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:513
value_type * pointer
Definition list.hpp:140
const_iterator cend() const noexcept override
Returns an iterator to the element following the last element of the enumerable.
Definition list.hpp:316
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:1031
xtd::collections::object_model::read_only_collection< value_type > read_only_collection
Definition list.hpp:152
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:635
type_t value_type
Represents the list value type.
Definition list.hpp:124
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:962
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:1021
iterator emplace(const_iterator pos, args_t &&... args)
Inserts a new element into the container directly before pos.
Definition list.hpp:709
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:187
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:998
virtual iterator insert(const_iterator pos, const type_t &&value)
Inserts elements at the specified location in the container.
Definition list.hpp:987
virtual reference back()
Returns a reference to the last element in the container.
Definition list.hpp:245
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 auto 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
delegate< void(arguments_t...)> action
Represents a xtd::delegate that has variable parameters and does not return a value.
Definition action.hpp:20
bool is(xtd::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
@ 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