Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
The parameterless constructor is used to create a list of strings with the default capacity. The xtd::collections::generic::list::capacity property is displayed and then the xtd::collections::generic::list::add method is used to add several items. The items are listed, and the xtd::collections::generic::list::capacity property is displayed again, along with the xtd::collections::generic::list::count property, to show that the capacity has been increased as needed.
The xtd::collections::generic::list::contains method is used to test for the presence of an item in the list, the Insert method is used to insert a new item in the middle of the list, and the contents of the list are displayed again.
The default xtd::collections::generic::list::operator [] is used to retrieve an item, the xtd::collections::generic::list::remove method is used to remove the first instance of the duplicate item added earlier, and the contents are displayed again. The xtd::collections::generic::list::remove method always removes the first instance it encounters.
The xtd::collections::generic::list::trim_excess method is used to reduce the capacity to match the count, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized.
Finally, the xtd::collections::generic::list::clear method is used to remove all items from the list, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed.
bool
exactly as other types unlike std::vector with xtd::collections::generic::helpers::allocator instead std::allocator. When the type_t
is bool
The underlying std::vector uses xtd::byte. type_t
is determined as follows. If type type_t
implements the xtd::iequatable <type_t> generic interface, then the equality comparer is the xtd::iequatable::equals method of that interface; otherwise, if the type_t
inherits of the xtd::object class, the default equality comparer is xtd::object::equals. If the type_t
does not implement the xtd::iequality <type_t> interface and does not inherit from xtd::object, the type_t
must implement the euqality operator : bool operator ==(const type_t& rhs) const noexcept
.type_t
is determined as follows. If type type_t
implements the xtd::icomparable <type_t> generic interface, then the default comparer is the xtd::icomaprable::compare_to method of that interface. If the type_t
type does not implement the xtd::icomparable <type_t> interface, the type_t
type must implement the less than operator : bool operator <(const type_t& rhs) const noexcept
. Public Aliases | |
using | value_type |
Represents the list value type. | |
using | base_type |
Represents the list base type. | |
using | const_base_type |
Represents the list base type. | |
using | size_type |
Represents the list size type (usually xtd::size). | |
using | reference |
Represents the reference of list value type. | |
using | const_reference |
Represents the const reference of list value type. | |
using | pointer |
Represents the pointer of list value type. | |
using | const_pointer |
Represents the const pointer of list value type. | |
using | read_only_collection |
Represents the read only collection of of list. | |
Public Constructors | |
list () noexcept=default | |
Initializes a new instance of the xtd::collections::generic::list class that is empty. | |
list (size_type capacity) | |
Constructs the container with specified count default-inserted instances of type_t. No copies are made. | |
list (const xtd::collections::generic::ienumerable< type_t > &collection) | |
Initializes a new instance of the xtd::collections::generic::list <type_t> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied. | |
list (const list &list) | |
Default copy constructor with specified list. | |
list (list &&list) | |
Move constructor with specified list. | |
list (const base_type &list) | |
Copy constructor with specified base type list. | |
list (base_type &&list) | |
Move constructor with specified base type list. | |
list (std::initializer_list< type_t > items) | |
Constructs the container with the contents of the specified initializer list, and allocator. | |
template<std::input_iterator input_iterator_t> | |
list (input_iterator_t first, input_iterator_t last) | |
Constructs the container with the contents of the range [first, last). | |
Public Properties | |
size_type | capacity () const noexcept |
Gets the total number of elements the internal data structure can hold without resizing. | |
void | capacity (size_type value) |
Sets the total number of elements the internal data structure can hold without resizing. | |
size_type | count () const noexcept override |
Gets the number of elements contained in the xtd::collections::generic::list <type_t>. | |
pointer | data () noexcept |
Returns pointer to the underlying array serving as element storage. | |
const_pointer | data () const noexcept |
Returns pointer to the underlying array serving as element storage. | |
const auto & | items () const noexcept |
Returns the underlying base type items. | |
auto & | items () noexcept |
Returns the underlying base type items. | |
Public Methods | |
void | add (const type_t &item) override |
Adds an object to the end of the xtd::collections::generic::list <type_t>. | |
void | add (type_t &&item) |
Adds an object to the end of the xtd::collections::generic::list <type_t>. | |
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 <type_t>. | |
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 <type_t>. | |
read_only_collection | as_read_only () const noexcept |
Returns a read-only xtd::collections::object_model::read_only_collection <type_t> wrapper for the current collection. | |
xtd::size | binary_search (const type_t &item) const noexcept |
Searches the entire sorted xtd::collections::generic::list <type_t> for an element using the default comparer and returns the zero-based index of the element. | |
xtd::size | binary_search (const type_t &item, const xtd::collections::generic::icomparer< type_t > &comparer) const noexcept |
Searches the entire sorted xtd::collections::generic::list <type_t> for an element using the specified comparer and returns the zero-based index of the element. | |
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 using the specified comparer and returns the zero-based index of the element. | |
void | clear () override |
Removes all elements from the xtd::collections::generic::list <type_t>. | |
bool | contains (const type_t &value) const noexcept override |
Determines whether an element is in the xtd::colllections::generic::list <type_t>. | |
template<class output_t, class converter_t> | |
list< output_t > | convert_all (converter_t converter) const |
Converts the elements in the current xtd::colllections::generic::list <type_t> to another type, and returns a list containing the converted elements. | |
void | copy_to (xtd::array< type_t > &array) const |
Copies the entire xtd::collections::generic::list <type_t> to a compatible one-dimensional array. | |
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, starting at the specified index of the target array. | |
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, starting at the specified index of the target array. | |
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 less than capacity , it is increased to at least the specified capacity . | |
bool | equals (const object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const list &obj) const noexcept override |
Indicates whether the current object is equal to another object of the same type. | |
template<class predicate_t> | |
bool | exists (predicate_t match) const |
Determines whether the xtd::collections::generic::list <type_t> contains elements that match the conditions defined by the specified predicate. | |
template<class predicate_t> | |
optional< type_t > | find (predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire xtd::collections::generic::list <type_t>. | |
template<class predicate_t> | |
list | find_all (predicate_t match) const |
Retrieves all the elements that match the conditions defined by the specified predicate. | |
template<class predicate_t> | |
xtd::size | find_index (predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire xtd::collections::generic::list <type_t>. | |
template<class predicate_t> | |
xtd::size | find_index (xtd::size start_index, predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the xtd::collections::generic::list <type_t> that extends from the specified index to the last element. | |
template<class predicate_t> | |
xtd::size | find_index (xtd::size start_index, xtd::size count, predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the xtd::collections::generic::list <type_t> that starts at the specified index and contains the specified number of elements. | |
template<class predicate_t> | |
optional< type_t > | find_last (predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire xtd::collections::generic::list <type_t>. | |
template<class predicate_t> | |
xtd::size | find_last_index (predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire xtd::collections::generic::list <type_t>. | |
template<class predicate_t> | |
xtd::size | find_last_index (xtd::size start_index, predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the xtd::collections::generic::list <type_t> that extends from the first element to the specified index. | |
template<class predicate_t> | |
xtd::size | find_last_index (xtd::size start_index, xtd::size count, predicate_t match) const |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the xtd::collections::generic::list <type_t> that contains the specified number of elements and ends at the specified index. | |
template<class action_t> | |
void | for_each (action_t action) |
Performs the specified action on each element of the xtd::collections::generic::list <type_t>. | |
enumerator< value_type > | get_enumerator () const noexcept override |
Returns an enumerator that iterates through the xtd::collections::generic::list <type_t>. | |
list | get_range (size_type index, size_type count) |
Creates a shallow copy of a range of elements in the source xtd::collections::generic::list <type_t>. | |
size_type | index_of (const type_t &value) const noexcept override |
Determines the index of a specific item in the xtd::collections::generic::list <type_t>. | |
size_type | index_of (const type_t &value, size_type index) const |
Determines the index of a specific item in the xtd::collections::generic::list <type_t>. | |
size_type | last_index_of (const type_t &value, size_type index) const |
Determines the index of a specific item in the xtd::collections::generic::list <type_t>. | |
size_type | last_index_of (const type_t &value, size_type index, size_type count) const |
Determines the last index of a specific item in the xtd::collections::generic::list <type_t>. | |
bool | remove (const type_t &item) noexcept override |
Removes the first occurrence of a specific object from the xtd::collections::generic::list <type_t>. | |
template<class predicate_t> | |
xtd::size | remove_all (predicate_t match) |
Removes all the elements that match the conditions defined by the specified predicate. | |
void | remove_at (size_type index) override |
Removes the element at the specified index of the xtd::collections::generic::list <type_t>. | |
void | remove_range (size_type index, size_type count) |
Removes a range of elements from the xtd::collections::generic::list <type_t>. | |
virtual void | resize (size_type count, const value_type &value) |
Resizes the container to contain count elements, does nothing if count == size(). / @param count The new size of the container. / @exception xtd::argument_out_of_range_exception xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. / @remarks If the current size is greater than count, the container is reduced to its first countelements. / @remarks If the current size is less than count, additional default-inserted elements are appended. virtual void resize(size_type count) {resize(count, value_type {});} / @brief Resizes the container to contain countelements, does nothing if count == size(). | |
void | reverse () |
Reverses the order of the elements in the entire xtd::collections::generic::list <type_t>. | |
void | reverse (size_type index, size_type count) |
Reverses the order of the elements in the specified range. | |
list< type_t > | slice (size_type start, size_type length) const |
Creates a shallow copy of a range of elements in the source xtd::collections::generic::list <type_t>. | |
list< type_t > & | sort () |
Sorts the elements in the entire xtd::collections::generic::list <type_t> using the default comparer. | |
list< type_t > & | sort (xtd::comparison< const type_t & > comparison) |
Sorts the elements in the entire xtd::collections::generic::list <type_t> using the specified xtd::comparison <type_t>. | |
list< type_t > & | sort (const xtd::collections::generic::icomparer< type_t > &comparer) |
Sorts the elements in the entire xtd::collections::generic::list <type_t> using the specified comparer. | |
list< type_t > & | sort (xtd::size index, xtd::size count, const xtd::collections::generic::icomparer< type_t > &comparer) |
Sorts the elements in a range of elements in xtd::collections::generic::list <type_t> using the specified comparer. | |
xtd::array< value_type > | to_array () const noexcept |
Copies the elements of the xtd::collections::generic::list <type_t> to a new array. | |
string | to_string () const noexcept override |
Returns a xtd::string that represents the current object. | |
void | trim_excess () |
Sets the capacity to the actual number of elements in the xtd::collections::generic::list <type_t>, if that number is less than a threshold value. | |
template<class prediacate_t> | |
bool | true_for_all (prediacate_t match) const |
Determines whether every element in the xtd::collections::generic::list <type_t> matches the conditions defined by the specified predicate. | |
Public Operators | |
list & | operator= (const list &other)=default |
Copy assignment operator. Replaces the contents with a copy of the contents of other. | |
list & | operator= (list &&other) noexcept |
Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards. | |
list & | operator= (const std::initializer_list< type_t > &items) |
Replaces the contents with those identified by initializer list ilist. | |
const_reference | operator[] (size_type index) const override |
Returns a reference to the element at specified location index. | |
reference | operator[] (size_type index) override |
Returns a reference to the element at specified location index. | |
operator const_base_type & () const noexcept | |
Returns a reference to the underlying base type. | |
operator base_type & () noexcept | |
Returns a reference to the underlying base type. | |
Additional Inherited Members | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual xtd::size | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t> | |
xtd::unique_ptr_object< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual bool | equals (const type_t &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
template<class object_a_t, class object_b_t> | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t, class object_b_t> | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
using xtd::collections::generic::list< type_t, allocator_t >::value_type |
Represents the list value type.
using xtd::collections::generic::list< type_t, allocator_t >::base_type |
Represents the list base type.
using xtd::collections::generic::list< type_t, allocator_t >::const_base_type |
Represents the list base type.
using xtd::collections::generic::list< type_t, allocator_t >::size_type |
Represents the list size type (usually xtd::size).
using xtd::collections::generic::list< type_t, allocator_t >::reference |
Represents the reference of list value type.
using xtd::collections::generic::list< type_t, allocator_t >::const_reference |
Represents the const reference of list value type.
using xtd::collections::generic::list< type_t, allocator_t >::pointer |
Represents the pointer of list value type.
using xtd::collections::generic::list< type_t, allocator_t >::const_pointer |
Represents the const pointer of list value type.
using xtd::collections::generic::list< type_t, allocator_t >::read_only_collection |
Represents the read only collection of of list.
|
defaultnoexcept |
Initializes a new instance of the xtd::collections::generic::list class that is empty.
|
inlineexplicit |
Constructs the container with specified count default-inserted instances of type_t. No copies are made.
capacity | The number of elements that the new list can initially store. |
xtd::out_of_memory | There is not enough memory available on the system. |
|
inline |
Initializes a new instance of the xtd::collections::generic::list <type_t> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.
collection | The collection whose elements are copied to the new list. |
|
inline |
Default copy constructor with specified list.
list | The xtd::collections::generic::list which elements will be inserted from. |
|
inline |
Move constructor with specified list.
list | The xtd::collections::generic::list which elements will be moved from. |
|
inline |
Copy constructor with specified base type list.
list | The xtd::collections::generic::list::base_type which elements will be inserted from. |
|
inline |
Move constructor with specified base type list.
list | The xtd::collections::generic::list::base_type which elements will be moved from. |
|
inline |
Constructs the container with the contents of the specified initializer list, and allocator.
items | The initializer list to initialize the elements of the container with. |
|
inline |
Constructs the container with the contents of the range [first, last).
first | The first iterator the range to copy the elements from. |
last | The last iterator the range to copy the elements from. |
alloc | The allocator to use for all memory allocations of this container. |
|
inlinenoexcept |
Gets the total number of elements the internal data structure can hold without resizing.
xtd::argument_out_of_range_exception | xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. |
The parameterless constructor is used to create a list of strings with the default capacity. The xtd::collections::generic::list::capacity property is displayed and then the xtd::collections::generic::list::add method is used to add several items. The items are listed, and the xtd::collections::generic::list::capacity property is displayed again, along with the xtd::collections::generic::list::count property, to show that the capacity has been increased as needed.
The xtd::collections::generic::list::contains method is used to test for the presence of an item in the list, the Insert method is used to insert a new item in the middle of the list, and the contents of the list are displayed again.
The default xtd::collections::generic::list::operator [] is used to retrieve an item, the xtd::collections::generic::list::remove method is used to remove the first instance of the duplicate item added earlier, and the contents are displayed again. The xtd::collections::generic::list::remove method always removes the first instance it encounters.
The xtd::collections::generic::list::trim_excess method is used to reduce the capacity to match the count, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized.
Finally, the xtd::collections::generic::list::clear method is used to remove all items from the list, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed.
|
inline |
Sets the total number of elements the internal data structure can hold without resizing.
xtd::out_of_memory | There is not enough memory available on the system. |
xtd::argument_out_of_range_exception | xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. |
The parameterless constructor is used to create a list of strings with the default capacity. The xtd::collections::generic::list::capacity property is displayed and then the xtd::collections::generic::list::add method is used to add several items. The items are listed, and the xtd::collections::generic::list::capacity property is displayed again, along with the xtd::collections::generic::list::count property, to show that the capacity has been increased as needed.
The xtd::collections::generic::list::contains method is used to test for the presence of an item in the list, the Insert method is used to insert a new item in the middle of the list, and the contents of the list are displayed again.
The default xtd::collections::generic::list::operator [] is used to retrieve an item, the xtd::collections::generic::list::remove method is used to remove the first instance of the duplicate item added earlier, and the contents are displayed again. The xtd::collections::generic::list::remove method always removes the first instance it encounters.
The xtd::collections::generic::list::trim_excess method is used to reduce the capacity to match the count, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized.
Finally, the xtd::collections::generic::list::clear method is used to remove all items from the list, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed.
|
inlineoverridenoexcept |
Gets the number of elements contained in the xtd::collections::generic::list <type_t>.
The parameterless constructor is used to create a list of strings with the default capacity. The xtd::collections::generic::list::capacity property is displayed and then the xtd::collections::generic::list::add method is used to add several items. The items are listed, and the xtd::collections::generic::list::capacity property is displayed again, along with the xtd::collections::generic::list::count property, to show that the capacity has been increased as needed.
The xtd::collections::generic::list::contains method is used to test for the presence of an item in the list, the Insert method is used to insert a new item in the middle of the list, and the contents of the list are displayed again.
The default xtd::collections::generic::list::operator [] is used to retrieve an item, the xtd::collections::generic::list::remove method is used to remove the first instance of the duplicate item added earlier, and the contents are displayed again. The xtd::collections::generic::list::remove method always removes the first instance it encounters.
The xtd::collections::generic::list::trim_excess method is used to reduce the capacity to match the count, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized.
Finally, the xtd::collections::generic::list::clear method is used to remove all items from the list, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed.
|
inlinenoexcept |
Returns pointer to the underlying array serving as element storage.
|
inlinenoexcept |
Returns pointer to the underlying array serving as element storage.
|
inlinenoexcept |
Returns the underlying base type items.
|
inlinenoexcept |
Returns the underlying base type items.
|
inlineoverride |
Adds an object to the end of the xtd::collections::generic::list <type_t>.
item | The object to be added to the end of the xtd::collections::generic::list <type_t>. @)ar Examples The following example demonstrates how to add, remove, and insert a simple business object in a xtd::collections::generic::list <type_t>. #include <xtd/xtd>
// Simple business object. A part_id is used to identify the type of part
// but the part name can change.
public:
string part_name;
int part_id = 0;
part() = default;
part(const string& name, int id) : part_name {name}, part_id {id} {}
string to_string() const noexcept override {return string::format("ID: {} Name: {}", part_id, part_name);}
bool equals(const object& obj) const noexcept override {return is<part>(obj) && equals(as<part>(obj));}
size get_hash_code() const noexcept override {return part_id;}
};
class example {
public:
static auto main() -> void {
// Create a list of parts.
auto parts = list<part>();
// Add parts to the list.
parts.add(part {"crank arm", 1234});
parts.add(part {"chain ring", 1334});
parts.add(part {"regular seat", 1434});
parts.add(part {"banana seat", 1444});
parts.add(part {"cassette", 1534});
parts.add(part {"shift lever", 1634});
// Write out the parts in the list. This will call the overridden ToString method
// in the part class.
console::write_line();
for (auto part : parts)
console::write_line(part);
// Check the list for part #1734. This calls the iequatable::equals method of the part class, which checks the partId for equality.
console::write_line("\ncontains(\"1734\"): {0}", parts.contains(part {"", 1734}));
// Insert a new item at position 2.
console::write_line("\nInsert(2, \"1834\")");
parts.insert(2, part {"brake lever", 1834});
//console::write_line();
for (auto part : parts)
console::write_line(part);
console::write_line("\nparts[3]: {0}", parts[3]);
console::write_line("\nremove(\"1534\")");
// This will remove part 1534 even though the partName is different, because the equals method only checks part_id for equality.
parts.remove(part {"cogs", 1534});
console::write_line();
for (auto part : parts)
console::write_line(part);
console::write_line("\nremove_at(3)");
// This will remove the part at index 3.
parts.remove_at(3);
console::write_line();
for (auto part : parts)
console::write_line(part);
}
};
startup_(example::main);
// This code produces the following output :
//
//
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1434 Name: regular seat
// ID: 1444 Name: banana seat
// ID: 1534 Name: cassette
// ID: 1634 Name: shift lever
//
// contains("1734"): false
//
// Insert(2, "1834")
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1834 Name: brake lever
// ID: 1434 Name: regular seat
// ID: 1444 Name: banana seat
// ID: 1534 Name: cassette
// ID: 1634 Name: shift lever
//
// parts[3]: ID: 1434 Name: regular seat
//
// remove("1534")
//
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1834 Name: brake lever
// ID: 1434 Name: regular seat
// ID: 1444 Name: banana seat
// ID: 1634 Name: shift lever
//
// remove_at(3)
//
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1834 Name: brake lever
// ID: 1444 Name: banana seat
// ID: 1634 Name: shift lever
|
Other properties and methods are used to search for, insert, and remove elements from the list, and finally to clear the list.
|
inline |
Adds an object to the end of the xtd::collections::generic::list <type_t>.
item | The object to be added to the end of the xtd::collections::generic::list <type_t>. @)ar Examples The following example demonstrates how to add, remove, and insert a simple business object in a xtd::collections::generic::list <type_t>. #include <xtd/xtd>
// Simple business object. A part_id is used to identify the type of part
// but the part name can change.
public:
string part_name;
int part_id = 0;
part() = default;
part(const string& name, int id) : part_name {name}, part_id {id} {}
string to_string() const noexcept override {return string::format("ID: {} Name: {}", part_id, part_name);}
bool equals(const object& obj) const noexcept override {return is<part>(obj) && equals(as<part>(obj));}
size get_hash_code() const noexcept override {return part_id;}
};
class example {
public:
static auto main() -> void {
// Create a list of parts.
auto parts = list<part>();
// Add parts to the list.
parts.add(part {"crank arm", 1234});
parts.add(part {"chain ring", 1334});
parts.add(part {"regular seat", 1434});
parts.add(part {"banana seat", 1444});
parts.add(part {"cassette", 1534});
parts.add(part {"shift lever", 1634});
// Write out the parts in the list. This will call the overridden ToString method
// in the part class.
console::write_line();
for (auto part : parts)
console::write_line(part);
// Check the list for part #1734. This calls the iequatable::equals method of the part class, which checks the partId for equality.
console::write_line("\ncontains(\"1734\"): {0}", parts.contains(part {"", 1734}));
// Insert a new item at position 2.
console::write_line("\nInsert(2, \"1834\")");
parts.insert(2, part {"brake lever", 1834});
//console::write_line();
for (auto part : parts)
console::write_line(part);
console::write_line("\nparts[3]: {0}", parts[3]);
console::write_line("\nremove(\"1534\")");
// This will remove part 1534 even though the partName is different, because the equals method only checks part_id for equality.
parts.remove(part {"cogs", 1534});
console::write_line();
for (auto part : parts)
console::write_line(part);
console::write_line("\nremove_at(3)");
// This will remove the part at index 3.
parts.remove_at(3);
console::write_line();
for (auto part : parts)
console::write_line(part);
}
};
startup_(example::main);
// This code produces the following output :
//
//
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1434 Name: regular seat
// ID: 1444 Name: banana seat
// ID: 1534 Name: cassette
// ID: 1634 Name: shift lever
//
// contains("1734"): false
//
// Insert(2, "1834")
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1834 Name: brake lever
// ID: 1434 Name: regular seat
// ID: 1444 Name: banana seat
// ID: 1534 Name: cassette
// ID: 1634 Name: shift lever
//
// parts[3]: ID: 1434 Name: regular seat
//
// remove("1534")
//
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1834 Name: brake lever
// ID: 1434 Name: regular seat
// ID: 1444 Name: banana seat
// ID: 1634 Name: shift lever
//
// remove_at(3)
//
// ID: 1234 Name: crank arm
// ID: 1334 Name: chain ring
// ID: 1834 Name: brake lever
// ID: 1444 Name: banana seat
// ID: 1634 Name: shift lever
|
Other properties and methods are used to search for, insert, and remove elements from the list, and finally to clear the list.
|
inline |
Adds copy of elements from the specified collection to the end of the xtd::collections::generic::list <type_t>.
collection | The collection whose elements should be added to the end of the xtd::collections::generic::list <type_t>. |
|
inline |
Adds copy of elements from the specified collection to the end of the xtd::collections::generic::list <type_t>.
il | The collection whose elements should be added to the end of the xtd::collections::generic::list <type_t>. |
|
inlinenoexcept |
Returns a read-only xtd::collections::object_model::read_only_collection <type_t> wrapper for the current collection.
|
inlinenoexcept |
Searches the entire sorted xtd::collections::generic::list <type_t> for an element using the default comparer and returns the zero-based index of the element.
item | The object to locate. |
xtd::invalid_operation_exception | The default comparer xtd::collections::generic::comparer::default_comparer cannot find an implementation of the xtd::icomparable <type_t> generic interface. |
type_t
to determine the order of list elements. The xtd::collections::generic::comparer::default_comparer property checks whether type type_t
implements the xtd::icomparable <type_t> generic interface and uses that implementation, if available. If not, xtd::collections::generic::comparer::default_comparer checks whether type type_t
implements the xtd::icomparable interface. If type type_t
does not implement either interface, xtd::collections::generic::comparer::default_comparer throws an xtd::invalid_operation_exception.
|
inlinenoexcept |
Searches the entire sorted xtd::collections::generic::list <type_t> for an element using the specified comparer and returns the zero-based index of the element.
item | The object to locate. |
comparer | The xtd::collections::generic::icomparer <type_t> implementation to use when comparing elements. |
xtd::invalid_operation_exception | The default comparer xtd::collections::generic::comparer::default_comparer cannot find an implementation of the xtd::icomparable <type_t> generic interface. |
|
inline |
Searches a range of elements in the sorted xtd::collections::generic::list <type_t> for an element using the specified comparer and returns the zero-based index of the element.
index | The zero-based starting index of the range to search. |
count | The length of the range to search. |
item | The object to locate. |
comparer | The xtd::collections::generic::icomparer <type_t> implementation to use when comparing elements, or null to use the default comparer xtd::collections::generic::comparer<type_t>::default_comparer. |
xtd::argument_out_of_range_exception | `index` and `count` do not denote a valid range in the xtd::collections::generic::list <type_t>. |
xtd::invalid_operation_exception | The default comparer xtd::collections::generic::comparer::default_comparer cannot find an implementation of the xtd::icomparable <type_t> generic interface. |
|
inlineoverride |
Removes all elements from the xtd::collections::generic::list <type_t>.
|
inlineoverridenoexcept |
Determines whether an element is in the xtd::colllections::generic::list <type_t>.
value | The object to locate in the xtd::colllections::generic::list <type_t>. The value can be null for reference types. |
true
if item is found in the xtd::colllections::generic::list <type_t>; otherwise, false
.
|
inline |
Converts the elements in the current xtd::colllections::generic::list <type_t> to another type, and returns a list containing the converted elements.
output_t | The type of the elements of the target array. |
converter | A xtd::converter <output_t, input_t> delegate that converts each element from one type to another type. |
point_f_to_point
that converts a xtd::drawing::point_f structure to a xtd::drawing::point structure. The example then creates a xtd::collections::generic::list <type_t> of xtd::drawing::point_f structures, creates a xtd::converter <point_f, point> delegate to represent the point_f_to_point
method, and passes the delegate to the xtd::collections::generic::list::convert_all method. The xtd::collections::generic::list::convert_all method passes each element of the input list to the point_f_to_point
method and puts the converted elements into a new list of Point structures. Both lists are displayed.
|
inline |
Copies the entire xtd::collections::generic::list <type_t> to a compatible one-dimensional array.
array | The one-dimensional xtd::array that is the destination of the elements copied from ICollection. The xtd::array must have zero-based indexing. |
ArgumentNullException | array is null. |
ArgumentException | The number of elements in the source xtd::collections::generic::list <type_t> is greater than the number of elements that the destination array can contain. |
|
inlineoverride |
Copies the entire xtd::colllections::generic::list <type_t> to a compatible one-dimensional array, starting at the specified index of the target array.
array | The one-dimensional Array that is the destination of the elements copied from xtd::colllections::generic::list <type_t>. The Array must have zero-based indexing. |
array_index | The zero-based index in array at which copying begins. |
xtd::argument_out_of_range_exception | The number of elements in the source xtd::colllections::generic::list <type_t> is greater than the available space from arrayIndex to the end of the destination array. |
|
inline |
Copies the entire xtd::collections::generic::list <type_t> to a compatible one-dimensional array, starting at the specified index of the target array.
index | The zero-based index in the source xtd::collections::generic::list <type_t> at which copying begins. |
array | The one-dimensional xtd::array that is the destination of the elements copied from ICollection. The xtd::array must have zero-based indexing. |
arrayIndex | The zero-based index in array at which copying begins; |
count | The number of elements to copy. |
ArgumentNullException | array is null. |
ArgumentOutOfRangeException | The arrayIndex or count is less than 0. |
ArgumentException | The number of elements in the source xtd::collections::generic::list <type_t> is greater than the number of elements that the destination array can contain. |
|
inline |
Ensures that the capacity of this list is at least the specified capacity
. If the current capacity is less than capacity
, it is increased to at least the specified capacity
.
capacity | The minimum capacity to ensure. |
xtd::out_of_memory | There is not enough memory available on the system. |
|
inlineoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Reimplemented from xtd::object.
Reimplemented in xtd::diagnostics::trace_listener_collection.
|
inlineoverridenoexcept |
Indicates whether the current object is equal to another object of the same type.
obj | An object to compare with this object. |
true
if the current object is equal to the other parameter; otherwise, false
.
|
inline |
Determines whether the xtd::collections::generic::list <type_t> contains elements that match the conditions defined by the specified predicate.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
true
if the xtd::collections::generic::list <type_t> contains one or more elements that match the conditions defined by the specified predicate
; otherwise, false
. ends_with_saurus
, which accepts a string parameter and returns a boolean value indicating whether the input string ends in "saurus". ends_with_saurus
method. The search stops and the method returns true
if the ends_with_saurus
method returns true
for any element. The xtd::collections::generic::list::exists method returns false
because all such elements have been removed.
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire xtd::collections::generic::list <type_t>.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
predicate
, if found; otherwise, the default value for type type_t
. ends_with_saurus
, which accepts a string parameter and returns a boolean value indicating whether the input string ends in "saurus". ends_with_saurus
method. The search stops and the method returns true
if the ends_with_saurus
method returns true
for any element. The xtd::collections::generic::list::exists method returns false
because all such elements have been removed.
|
inline |
Retrieves all the elements that match the conditions defined by the specified predicate.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
predicate
, if found; otherwise, an empty xtd::collections::generic::list <type_t>. ends_with_saurus
, which accepts a string parameter and returns a boolean value indicating whether the input string ends in "saurus". ends_with_saurus
method. The search stops and the method returns true
if the ends_with_saurus
method returns true
for any element. The xtd::collections::generic::list::exists method returns false
because all such elements have been removed.
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire xtd::collections::generic::list <type_t>.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the xtd::collections::generic::list <type_t> that extends from the specified index to the last element.
start_index | The zero-based starting index of the search. |
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
xtd::argument_out_of_range_exception | `start_index` is outside the range of valid indexes for the xtd::collections::generic::list <type_t>.. |
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the xtd::collections::generic::list <type_t> that starts at the specified index and contains the specified number of elements.
start_index | The zero-based starting index of the search. |
count | The number of elements in the section to search. |
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
xtd::argument_out_of_range_exception | `start_index` is outside the range of valid indexes for the xtd::collections::generic::list <type_t>. -or- `start_index` and `count` do not specify a valid section in the xtd::collections::generic::list <type_t>. |
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire xtd::collections::generic::list <type_t>.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
type_t
. ends_with_saurus
, which accepts a string parameter and returns a boolean value indicating whether the input string ends in "saurus". ends_with_saurus
method. The search stops and the method returns true
if the ends_with_saurus
method returns true
for any element. The xtd::collections::generic::list::exists method returns false
because all such elements have been removed.
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire xtd::collections::generic::list <type_t>.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the xtd::collections::generic::list <type_t> that extends from the first element to the specified index.
start_index | The zero-based starting index of the backward search. |
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
xtd::argument_out_of_range_exception | `start_index` is outside the range of valid indexes for the xtd::collections::generic::list <type_t>. |
|
inline |
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the xtd::collections::generic::list <type_t> that contains the specified number of elements and ends at the specified index.
start_index | The zero-based starting index of the backward search. |
count | The number of elements in the section to search. |
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
xtd::argument_out_of_range_exception | `start_index` is outside the range of valid indexes for the xtd::collections::generic::list <type_t>. -or- `start_index` and `count` do not specify a valid section in the xtd::collections::generic::list <type_t>. |
|
inline |
Performs the specified action on each element of the xtd::collections::generic::list <type_t>.
action | The xtd::action <type_t> delegate to perform on each element of the xtd::collections::generic::list <type_t>. |
print
method is used to display the contents of the list to the console.
|
inlineoverridenoexcept |
Returns an enumerator that iterates through the xtd::collections::generic::list <type_t>.
|
inline |
Creates a shallow copy of a range of elements in the source xtd::collections::generic::list <type_t>.
index | The zero-based xtd::collections::generic::list <type_t> index at which the range starts. |
count | The number of elements in the range. |
xtd::argument_out_of_range_exception | index and count do ! denote a valid range of elements in the xtd::collections::generic::list <type_t>. |
|
inlineoverridenoexcept |
Determines the index of a specific item in the xtd::collections::generic::list <type_t>.
value | The object to locate in the xtd::collections::generic::list <type_t>. |
|
inline |
Determines the index of a specific item in the xtd::collections::generic::list <type_t>.
value | The object to locate in the xtd::collections::generic::list <type_t>. |
index | The zero-based starting index of the search. |
xtd::argument_out_of_range_exception | `index` is outside the range of valid indexes for the xtd::collections::generic::list <type_t>. |
|
inline |
Determines the index of a specific item in the xtd::collections::generic::list <type_t>.
value | The object to locate in the xtd::collections::generic::list <type_t>. |
index | The zero-based starting index of the search. |
count | The number of elements in the section to search |
xtd::argument_out_of_range_exception | `index` and `countù do not specify a valid section in the xtd::collections::generic::list <type_t>. size_type index_of(const type_t& value, size_type index, size_type count) const { return find_index(index, count, delegate_(auto n) {return helpers::equator<type_t> {}(n, value);}); } |
/ Inserts an element into the xtd::collections::generic::list <type_t> at the specified index. /
index | The zero-based index at which the new element should be inserted. / |
value | The element should be inserted into the xtd::collections::generic::list <type_t>. / |
xtd::argument_out_of_range_exception | index is is greater than xtd::collections::generic::list::count. / |
index | The zero-based index at which the new element should be inserted. / |
value | The element should be inserted into the xtd::collections::generic::list <type_t>. / |
xtd::argument_out_of_range_exception | index is is greater than xtd::collections::generic::list::count. / |
/ Inserts copy of elements from a collection into the xtd::collections::generic::list <type_t> at the specified index. /
index | The zero-based index at which the new elements should be inserted. / |
collection | The collection whose elements should be inserted into the xtd::collections::generic::list <type_t>. / |
xtd::argument_out_of_range_exception | index is is greater than xtd::collections::generic::list::count. / |
If the collection is this instance, it must be copied to avoid an infinite loop. if (static_cast<const void*>(&enumerable) == static_cast<const void*>(this)) { insert_range(index, list(enumerable)); return; }
data_->items.insert(data_->items.begin() + index, enumerable.begin(), enumerable.end()); } / Inserts copy of elements from a collection into the xtd::collections::generic::list <type_t> at the specified index. /
index | The zero-based index at which the new elements should be inserted. / |
collection | The collection whose elements should be inserted into the xtd::collections::generic::list <type_t>. / |
xtd::argument_out_of_range_exception | index is is greater than xtd::collections::generic::list::count. / |
/
/ Determines the last index of a specific item in the xtd::collections::generic::list <type_t>. /
value | The object to locate in the xtd::collections::generic::list <type_t>. / |
value | The object to locate in the xtd::collections::generic::list <type_t>. / |
index | The zero-based starting index of the search. / |
xd::argument_out_of_range_exception | The parameters `indexù is greater than xtd::collections::generic::list::count(). |
|
inline |
Determines the last index of a specific item in the xtd::collections::generic::list <type_t>.
value | The object to locate in the xtd::collections::generic::list <type_t>. |
index | The zero-based starting index of the search. |
count | The number of elements in the section to search |
xd::argument_out_of_range_exception | `index` and `count` do not specify a valid section in the xtd::collections::generic::list <type_t>. |
|
inlineoverridenoexcept |
Removes the first occurrence of a specific object from the xtd::collections::generic::list <type_t>.
item | The object to remove from the xtd::collections::generic::list <type_t>. |
true
if item is successfully removed; otherwise, false
. This method also returns false
if item was not found in the xtd::collections::generic::list <type_t>. typ_t
implements the xtd::iequatable <type_t> generic interface, the equality comparer is the xtd::iequatable::equals method of that interface; otherwise, the default equality comparer is xtd::object::equals.
|
inline |
Removes all the elements that match the conditions defined by the specified predicate.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
ends_with_saurus
, which accepts a string parameter and returns a boolean value indicating whether the input string ends in "saurus". ends_with_saurus
method. The search stops and the method returns true
if the ends_with_saurus
method returns true
for any element. The xtd::collections::generic::list::exists method returns false
because all such elements have been removed.
|
inlineoverride |
Removes the element at the specified index of the xtd::collections::generic::list <type_t>.
index | The zero-based index of the item to remove |
ArgumentOutOfRangeException | index is less than 0 or index is greater than xtd::collections::generic::list::count. |
|
inline |
Removes a range of elements from the xtd::collections::generic::list <type_t>.
index | The zero-based index of the item to remove |
count | The number of elements to remove |
xtd::argument_out_of_range_exception | index or count is less than 0 or index + count is greater than xtd::collections::generic::list::count. |
|
inlinevirtual |
Resizes the container to contain count
elements, does nothing if count == size(). / @param count The new size of the container. / @exception xtd::argument_out_of_range_exception xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. / @remarks If the current size is greater than
count, the container is reduced to its first
countelements. / @remarks If the current size is less than
count, additional default-inserted elements are appended. virtual void resize(size_type count) {resize(count, value_type {});} / @brief Resizes the container to contain
countelements, does nothing if
count == size().
count | The new size of the container. |
value | The value to initialize the new elements with. |
xtd::argument_out_of_range_exception | xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. |
count
, the container is reduced to its first count
elements. count
, additional copies of value
are appended.
|
inline |
Reverses the order of the elements in the entire xtd::collections::generic::list <type_t>.
|
inline |
Reverses the order of the elements in the specified range.
index | The zero-based starting index of the range to reverse. |
count | The number of elements in the range to reverse. |
xtd::argument_out_of_range_exception | `index` and `count` do not denote a valid range of elements in the xtd::collections::generic::list <type_t>. |
|
inline |
Creates a shallow copy of a range of elements in the source xtd::collections::generic::list <type_t>.
start | The zero-based xtd::collections::generic::list <type_t> index at which the range starts. |
length | The length of the range. |
xt::argument_out_of_range_exception | `start` and `length` do not denote a valid range of elements in the xtd::collections::generic::list <type_t>. |
|
inline |
Sorts the elements in the entire xtd::collections::generic::list <type_t> using the default comparer.
xtd::invalid_operation_exception | The default comparer xtd::collections::generic::comparer::default_comparer cannot find an implementation of the xtd::icomparable <type_t> generic interface. |
type_t
to determine the order of list elements. The xtd::collections::generic::comparer::default_comparer property checks whether type type_t
implements the xtd::icomparable <type_t> generic interface and uses that implementation, if available. If not, xtd::collections::generic::comparer::default_comparer checks whether type T implements the xtd::icomparable interface. If type type_t
does not implement either interface, xtd::collections::generic::comparer::default_comparer throws an xtd::invalid_operation_exception.
|
inline |
Sorts the elements in the entire xtd::collections::generic::list <type_t> using the specified xtd::comparison <type_t>.
xtd::argument_out_of_range_exception | The implementation of comparison caused an error during the sort. For example, comparison might not return 0 when comparing an item with itself. |
|
inline |
Sorts the elements in the entire xtd::collections::generic::list <type_t> using the specified comparer.
comparer | The xtd::collections::generic::icomparer <type_t> implementation to use when comparing elements, or null to use the default comparer xtd::collections::generic::comparer::default_comparer. |
|
inline |
Sorts the elements in a range of elements in xtd::collections::generic::list <type_t> using the specified comparer.
index | The zero-based starting index of the range to sort. |
count | The length of the range to sort. |
comparer | The xtd::collections::generic::icomparer <type_t> implementation to use when comparing elements, or null to use the default comparer xtd::collections::generic::comparer::default_comparer. |
xtd::argument_out_of_range_exception | The implementation of comparison caused an error during the sort. For example, comparison might not return 0 when comparing an item with itself. |
|
inlinenoexcept |
Copies the elements of the xtd::collections::generic::list <type_t> to a new array.
|
inlineoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
|
inline |
Sets the capacity to the actual number of elements in the xtd::collections::generic::list <type_t>, if that number is less than a threshold value.
The parameterless constructor is used to create a list of strings with the default capacity. The xtd::collections::generic::list::capacity property is displayed and then the xtd::collections::generic::list::add method is used to add several items. The items are listed, and the xtd::collections::generic::list::capacity property is displayed again, along with the xtd::collections::generic::list::count property, to show that the capacity has been increased as needed.
The xtd::collections::generic::list::contains method is used to test for the presence of an item in the list, the Insert method is used to insert a new item in the middle of the list, and the contents of the list are displayed again.
The default xtd::collections::generic::list::operator [] is used to retrieve an item, the xtd::collections::generic::list::remove method is used to remove the first instance of the duplicate item added earlier, and the contents are displayed again. The xtd::collections::generic::list::remove method always removes the first instance it encounters.
The xtd::collections::generic::list::trim_excess method is used to reduce the capacity to match the count, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized.
Finally, the xtd::collections::generic::list::clear method is used to remove all items from the list, and the xtd::collections::generic::list::capacity and xtd::collections::generic::list::count properties are displayed.
|
inline |
Determines whether every element in the xtd::collections::generic::list <type_t> matches the conditions defined by the specified predicate.
match | The xtd::predicate <type_t> delegate that defines the conditions of the elements to search for. |
true
if every element in the xtd::collections::generic::list <type_t> matches the conditions defined by the specified predicate
; otherwise, false
. If the list has no elements, the return value is true
. ends_with_saurus
, which accepts a string parameter and returns a boolean value indicating whether the input string ends in "saurus". ends_with_saurus
method. The search stops and the method returns true
if the ends_with_saurus
method returns true
for any element. The xtd::collections::generic::list::exists method returns false
because all such elements have been removed.
|
default |
Copy assignment operator. Replaces the contents with a copy of the contents of other.
other | Another container to use as data source. |
|
inlinenoexcept |
Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards.
other | Another base type container to use as data source. |
|
inline |
Replaces the contents with those identified by initializer list ilist.
items | Initializer list to use as data source |
|
inlineoverride |
Returns a reference to the element at specified location index.
index | The position of the element to return. |
std::out_of_range | If `index` is not within the range of the container. |
|
inlineoverride |
Returns a reference to the element at specified location index.
index | The position of the element to return. |
std::out_of_range | If `index` is not within the range of the container. |
|
inlinenoexcept |
Returns a reference to the underlying base type.
|
inlinenoexcept |
Returns a reference to the underlying base type.