xtd 1.0.0
Loading...
Searching...
No Matches
xtd::forms::layout::arranged_element_collection< type_t, sorter_t > Class Template Reference
Inheritance diagram for xtd::forms::layout::arranged_element_collection< type_t, sorter_t >:
xtd::object

Definition

template<typename type_t, typename sorter_t = sorter_none>
class xtd::forms::layout::arranged_element_collection< type_t, sorter_t >

Represents a collection of objects.

Header
#include <xtd/forms/layout/arranged_element_collection>
Namespace
xtd::forms::layout
Library
xtd.forms
Remarks
The xtd::forms::layout::arranged_element_collection class represents a collection of objects arranged on a design surface or inside a parent xtd.forms::container_control.
xtd::forms::layout::arranged_element_collection inherits from xtd::collections::generic::icollection instead of xtd::collections::generic::ilistto allow operator[] to return value_type, which triggers updates and events on element changes.
Returning type_t& would bypass these updates, while returning value_type& would break the xtd::collections::generic::ilist interface.
This keeps the collection safe and consistent, while most developers can still use xtd::forms::layout::arranged_element_collection::add_range() or xtd::forms::layout::arranged_element_collection::operator[] as expected.

Classes

class  value_type
 Represents the value type of the collection. More...

Public Aliases

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::usize).
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 Deprecatd Aliases

using reverse_iterator
 Represents the reverse iterator type of the collection.
using const_reverse_iterator
 Represents the const reverse iterator type of the collection.

Public Fields

static constexpr xtd::usize npos
 Represents a value that is not a valid position in a collection.
static constexpr xtd::usize bpos
 Represents the index of the first valid element in a collection.
static constexpr xtd::usize epos
 Represents the index of the last valid element in a collection.

Public Events

event< arranged_element_collection, delegate< void(xtd::usize, type_t &item)> > item_added
 Occurs when an item is added to the collection.
event< arranged_element_collection, delegate< void(xtd::usize, type_t &item)> > item_updated
 Occurs when an item is updated in the collection.
event< arranged_element_collection, delegate< void(xtd::usize, type_t &item)> > item_removed
 Occurs when an item is removed from the collection.

Public Constructors

 arranged_element_collection ()=default
 Initializes a new instance of the xtd::forms::layout::arranged_element_collection class that is empty.
 arranged_element_collection (size_type capacity)
 Constructs the container with specified count default-inserted instances of type_t. No copies are made.
 arranged_element_collection (const xtd::collections::generic::ienumerable< type_t > &collection)
 Initializes a new instance of the xtd::forms::layout::arranged_element_collection <type_t> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.
 arranged_element_collection (const arranged_element_collection &collection)
 Default copy constructor with specified list.
 arranged_element_collection (arranged_element_collection &&collection)
 Move constructor with specified list.
 arranged_element_collection (const base_type &collection)
 Copy constructor with specified base type list.
 arranged_element_collection (base_type &&collection)
 Move constructor with specified base type list.
 arranged_element_collection (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>
 arranged_element_collection (input_iterator_t first, input_iterator_t last)
 Constructs the container with the contents of the range [first, last).

Public Properties

auto capacity () const noexcept -> size_type
 Gets the total number of elements the internal data structure can hold without resizing.
auto capacity (size_type value) -> void
 Sets the total number of elements the internal data structure can hold without resizing.
auto count () const noexcept -> size_type override
 Gets the number of elements contained in the xtd::forms::layout::arranged_element_collection <type_t>.
auto data () -> pointer
 Direct access to the underlying array.
auto data () const -> const_pointer
 Direct access to the underlying array.
const auto & items () const
 Returns the underlying base type items.
auto & items ()
 Returns the underlying base type items.
virtual auto sorted () const noexcept -> bool
 Checks whether the container is sorted.
virtual auto sorted (bool value) -> arranged_element_collection &
 Sets the container is sorted.

Public Methods

auto add (const type_t &item) -> void override
 Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.
virtual auto add (type_t &&item) -> void
 Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.
virtual auto add_range (const arranged_element_collection &collection) -> void
 Adds elements to the end.
virtual auto add_range (const std::vector< type_t > &collection) -> void
 Adds elements to the end.
virtual auto add_range (const std::initializer_list< type_t > &collection) -> void
 Adds elements to the end.
template<typename collection_t>
auto add_range (collection_t &&collection) -> void
 Adds elements to the end.
template<typename collection_t>
auto add_range (const collection_t &collection) -> void
 Adds elements to the end.
auto clear () -> void override
 Removes all items from the xtd::forms::layout::arranged_element_collection <type_t>.
auto contains (const type_t &item) const noexcept -> bool override
 Determines whether the xtd::forms::layout::arranged_element_collection <type_t> contains a specific value.
auto copy_to (xtd::array< type_t > &array, xtd::usize array_index) const -> void override
 Copies the elements of the xtd::forms::layout::arranged_element_collection <type_t> to an xtd::array, starting at a particular xtd::array index.
auto get_enumerator () const noexcept -> xtd::collections::generic::enumerator< type_t > override
 Returns an enumerator that iterates through the xtd::forms::layout::arranged_element_collection <type_t>.
virtual auto insert (xtd::usize index, const type_t &value) -> void
 Inserts specified element at specified index.
virtual auto sort () -> arranged_element_collection &
 Sorts the content.
auto remove (const type_t &item) -> bool override
 Removes the first occurrence of a specific object from the xtd::forms::layout::arranged_element_collection <type_t>.
virtual auto remove_at (xtd::usize index) -> void
 Erases element at specified index.
auto reverse () -> arranged_element_collection &
 Reverses the order of the elements in the entire xtd::collections::generic::list <type_t>.
auto reverse (size_type index, size_type count) -> arranged_element_collection &
 Reverses the order of the elements in the specified range.
auto to_array () const noexcept -> xtd::array< type_t >
 Gets an array with the elements of the container.

Public Operators

auto operator= (const arranged_element_collection &other) -> arranged_element_collection &
 Copy assignment operator. Replaces the contents with a copy of the contents of other.
auto operator= (arranged_element_collection &&other) noexcept -> arranged_element_collection &
 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.
auto operator= (const std::initializer_list< type_t > &items) -> arranged_element_collection &
 Replaces the contents with those identified by initializer list ilist.
auto operator[] (size_type index) -> value_type &
 Access specified element.
auto operator[] (size_type index) const -> const value_type &
 Access specified element.
 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.
auto operator== (const arranged_element_collection &value) const -> bool
auto operator!= (const arranged_element_collection &value) const -> bool

Public Deprecatd Properties

auto max_size () const noexcept -> size_type
 Returns the maximum possible number of elements.

Public Deprecated Methods

auto at (size_type pos) -> reference
 Access specified element with bounds checking.
auto at (size_type pos) const -> const_reference
 Access specified element with bounds checking.
auto back () -> reference
 Access the last element.
auto back () const -> const_reference
 Access the last element.
auto crbegin () const noexcept -> const_reverse_iterator
 Returns a reverse iterator to the end.
auto crend () const noexcept -> const_reverse_iterator
 Returns a reverse iterator to the end.
auto front () -> reference
 Access the first element.
auto front () const -> const_reference
 Access the first element.
auto get_allocator () const noexcept
 Returns the associated allocator.
template<typename ... args_t>
auto emplace (xtd::collections::generic::list< value_type >::const_iterator pos, args_t &&... args) -> void
 Inserts specified element at specified position.
template<typename ... args_t>
auto emplace_back (args_t &&... args) -> void
 Adds an element to the end.
auto erase (xtd::collections::generic::list< value_type >::iterator pos)
 Erases element at specified position.
auto erase (xtd::collections::generic::list< value_type >::const_iterator pos)
 Erases element at specified position.
auto erase (xtd::collections::generic::list< value_type >::iterator first, xtd::collections::generic::list< value_type >::iterator last)
 Erases elements at specified range.
auto erase (xtd::collections::generic::list< value_type >::const_iterator first, xtd::collections::generic::list< value_type >::const_iterator last)
 Erases elements at specified range.
auto erase_at (xtd::usize index) -> void
 Erases element at specified index.
auto insert (xtd::collections::generic::list< value_type >::const_iterator pos, const type_t &value)
 Inserts specified element at specified position.
auto insert (xtd::collections::generic::list< value_type >::const_iterator pos, type_t &&value)
 Inserts specified element at specified position.
auto insert_at (xtd::usize index, const type_t &value) -> void
 Inserts specified element at specified index.
auto pop_back () -> void
 Removes the last element of the container.
auto push_back (const type_t &item) -> void
 Adds an element to the end.
auto push_back (type_t &&item) -> void
 Adds an element to the end.
auto push_back_range (const arranged_element_collection &collection) -> void
 Adds elements to the end.
auto push_back_range (const std::vector< type_t > &collection) -> void
 Adds elements to the end.
auto push_back_range (const std::initializer_list< type_t > &collection) -> void
 Adds elements to the end.
template<typename collection_t>
auto push_back_range (collection_t &&collection) -> void
 Adds elements to the end.
template<typename iterator_t>
auto push_back_range (iterator_t begin, iterator_t end) -> void
 Adds elements to the end.
auto to_vector () const noexcept -> std::vector< type_t >
 Gets an array with the elements of the container.
auto rbegin () noexcept
 Returns a reverse iterator to the end.
auto rbegin () const noexcept
 Returns a reverse iterator to the end.
auto rend () noexcept
 Returns a reverse iterator to the end.
auto rend () const noexcept
 Returns a reverse iterator to the end.
auto reserve (size_type size) -> void
 Reserves storage.
auto shrink_to_fit () -> void
 Reduces memory usage by freeing unused memory.

Protected Methods

virtual auto on_item_added (xtd::usize index, type_t &item) -> void
 Raises the xtd::forms::layout::arranged_element_collection::item_added event.
virtual auto on_item_updated (xtd::usize index, type_t &item) -> void
 Raises the xtd::forms::layout::arranged_element_collection::item_updated event.
virtual auto on_item_removed (xtd::usize index, type_t &item) -> void
 Raises the xtd::forms::layout::arranged_element_collection::item_removed event.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto equals (const object &obj) const noexcept -> bool
 Determines whether the specified object is equal to the current object.
virtual auto get_hash_code () const noexcept -> xtd::usize
 Serves as a hash function for a particular type.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
virtual auto to_string () const -> xtd::string
 Returns a xtd::string that represents the current object.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.

Member Typedef Documentation

◆ base_type

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::base_type

Represents the list base type.

◆ const_base_type

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_base_type

Represents the list base type.

◆ size_type

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::size_type

Represents the list size type (usually xtd::usize).

◆ reference

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reference

Represents the reference of list value type.

◆ const_reference

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_reference

Represents the const reference of list value type.

◆ pointer

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::pointer

Represents the pointer of list value type.

◆ const_pointer

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_pointer

Represents the const pointer of list value type.

◆ read_only_collection

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::read_only_collection

Represents the read only collection of of list.

◆ reverse_iterator

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reverse_iterator

Represents the reverse iterator type of the collection.

Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items::reverse_iterator - Will be removed in version 1.2.0.

◆ const_reverse_iterator

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_reverse_iterator

Represents the const reverse iterator type of the collection.

Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items::reverse_iterator - Will be removed in version 1.2.0.

Constructor & Destructor Documentation

◆ arranged_element_collection() [1/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( )
default

Initializes a new instance of the xtd::forms::layout::arranged_element_collection class that is empty.

Examples
The following code example demonstrates the default constructor of the xtd::forms::layout::arranged_element_collection generic class. The default constructor creates a list with the default capacity, as demonstrated by displaying the xtd::forms::layout::arranged_element_collection::capacity property.
#include <xtd/xtd>
class example {
public:
static auto main() -> void {
auto dinosaurs = list<string> {};
console::write_line("\ncapacity: {0}", dinosaurs.capacity());
dinosaurs.add("Tyrannosaurus");
dinosaurs.add("Amargasaurus");
dinosaurs.add("Mamenchisaurus");
dinosaurs.add("Deinonychus");
dinosaurs.add("Compsognathus");
for (auto dinosaur : dinosaurs)
console::write_line("\ncapacity: {0}", dinosaurs.capacity());
console::write_line("count: {0}", dinosaurs.count());
console::write_line("\ncontains(\"Deinonychus\"): {0}", dinosaurs.contains("Deinonychus"));
console::write_line("\ninsert(2, \"Compsognathus\")");
dinosaurs.insert(2, "Compsognathus");
for (auto dinosaur : dinosaurs)
// Shows accessing the list using the Item property.
console::write_line("\ndinosaurs[3]: {0}", dinosaurs[3]);
console::write_line("\nremove(\"Compsognathus\")");
dinosaurs.remove("Compsognathus");
for (auto dinosaur : dinosaurs)
dinosaurs.trim_excess();
console::write_line("\ntrim_excess()");
console::write_line("capacity: {0}", dinosaurs.capacity());
console::write_line("count: {0}", dinosaurs.count());
dinosaurs.clear();
console::write_line("\nclear()");
console::write_line("capacity: {0}", dinosaurs.capacity());
console::write_line("count: {0}", dinosaurs.count());
}
};
startup_(example::main);
// This code produces the following output :
//
// capacity: 0
//
// Tyrannosaurus
// Amargasaurus
// Mamenchisaurus
// Deinonychus
// Compsognathus
//
// capacity: 8
// count: 5
//
// contains("Deinonychus"): true
//
// insert(2, "Compsognathus")
//
// Tyrannosaurus
// Amargasaurus
// Compsognathus
// Mamenchisaurus
// Deinonychus
// Compsognathus
//
// dinosaurs[3]: Mamenchisaurus
//
// remove("Compsognathus")
//
// Tyrannosaurus
// Amargasaurus
// Mamenchisaurus
// Deinonychus
// Compsognathus
//
// trim_excess()
// capacity: 5
// count: 5
// clear()
// capacity: 5
// count: 0
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:284

◆ arranged_element_collection() [2/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( size_type capacity)
inlineexplicit

Constructs the container with specified count default-inserted instances of type_t. No copies are made.

Parameters
capacityThe number of elements that the new list can initially store.
Exceptions
xtd::out_of_memoryThere is not enough memory available on the system.
Examples
The following code example demonstrates the default constructor of the xtd::forms::layout::arranged_element_collection generic class. The default constructor creates a list with the default capacity, as demonstrated by displaying the xtd::forms::layout::arranged_element_collection::capacity property.
#include <xtd/xtd>
class example {
public:
static auto main() -> void {
auto dinosaurs = list<string> {};
console::write_line("\ncapacity: {0}", dinosaurs.capacity());
dinosaurs.add("Tyrannosaurus");
dinosaurs.add("Amargasaurus");
dinosaurs.add("Mamenchisaurus");
dinosaurs.add("Deinonychus");
dinosaurs.add("Compsognathus");
for (auto dinosaur : dinosaurs)
console::write_line("\ncapacity: {0}", dinosaurs.capacity());
console::write_line("count: {0}", dinosaurs.count());
console::write_line("\ncontains(\"Deinonychus\"): {0}", dinosaurs.contains("Deinonychus"));
console::write_line("\ninsert(2, \"Compsognathus\")");
dinosaurs.insert(2, "Compsognathus");
for (auto dinosaur : dinosaurs)
// Shows accessing the list using the Item property.
console::write_line("\ndinosaurs[3]: {0}", dinosaurs[3]);
console::write_line("\nremove(\"Compsognathus\")");
dinosaurs.remove("Compsognathus");
for (auto dinosaur : dinosaurs)
dinosaurs.trim_excess();
console::write_line("\ntrim_excess()");
console::write_line("capacity: {0}", dinosaurs.capacity());
console::write_line("count: {0}", dinosaurs.count());
dinosaurs.clear();
console::write_line("\nclear()");
console::write_line("capacity: {0}", dinosaurs.capacity());
console::write_line("count: {0}", dinosaurs.count());
}
};
startup_(example::main);
// This code produces the following output :
//
// capacity: 0
//
// Tyrannosaurus
// Amargasaurus
// Mamenchisaurus
// Deinonychus
// Compsognathus
//
// capacity: 8
// count: 5
//
// contains("Deinonychus"): true
//
// insert(2, "Compsognathus")
//
// Tyrannosaurus
// Amargasaurus
// Compsognathus
// Mamenchisaurus
// Deinonychus
// Compsognathus
//
// dinosaurs[3]: Mamenchisaurus
//
// remove("Compsognathus")
//
// Tyrannosaurus
// Amargasaurus
// Mamenchisaurus
// Deinonychus
// Compsognathus
//
// trim_excess()
// capacity: 5
// count: 5
// clear()
// capacity: 5
// count: 0

◆ arranged_element_collection() [3/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( const xtd::collections::generic::ienumerable< type_t > & collection)
inline

Initializes a new instance of the xtd::forms::layout::arranged_element_collection <type_t> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.

Parameters
collectionThe collection whose elements are copied to the new list.
Examples
The following code example demonstrates the xtd::forms::layout::arranged_element_collection <type_t> constructor and various methods of the xtd::forms::layout::arranged_element_collection <type_t> class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The xtd::forms::layout::arranged_element_collection::capacity property is then displayed, to show that the initial capacity is exactly what is required to hold the input elements.
#include <xtd/xtd>
class example {
public:
static auto main() -> void {
auto input = array<string> {"Brachiosaurus", "Amargasaurus", "Mamenchisaurus"};
auto dinosaurs = list<string>(input);
console::write_line("\ncapacity: {0}", dinosaurs.capacity());
for (auto dinosaur : dinosaurs)
console::write_line("\nadd_range(dinosaurs)");
dinosaurs.add_range(dinosaurs);
for(auto dinosaur : dinosaurs)
console::write_line("\nremove_range(2, 2)");
dinosaurs.remove_range(2, 2);
for(auto dinosaur : dinosaurs)
input = {"Tyrannosaurus", "Deinonychus", "Velociraptor"};
console::write_line("\ninsert_range(3, input)");
dinosaurs.insert_range(3, input);
for(auto dinosaur : dinosaurs)
console::write_line("\noutput = dinosaurs.get_range(2, 3).to_array()");
auto output = dinosaurs.get_range(2, 3).to_array();
for (auto dinosaur : output)
}
};
startup_(example::main);
// This code produces the following output :
//
//
// capacity: 3
//
// Brachiosaurus
// Amargasaurus
// Mamenchisaurus
//
// add_range(dinosaurs)
//
// Brachiosaurus
// Amargasaurus
// Mamenchisaurus
// Brachiosaurus
// Amargasaurus
// Mamenchisaurus
//
// remove_range(2, 2)
//
// Brachiosaurus
// Amargasaurus
// Amargasaurus
// Mamenchisaurus
//
// insert_range(3, input)
//
// Brachiosaurus
// Amargasaurus
// Amargasaurus
// Tyrannosaurus
// Deinonychus
// Velociraptor
// Mamenchisaurus
//
// output = dinosaurs.get_range(2, 3).to_array()
//
// Amargasaurus
// Tyrannosaurus
// Deinonychus
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Remarks
The elements are copied onto the xtd::forms::layout::arranged_element_collection <type_t> in the same order they are read by the enumerator of the collection.
This constructor is an O(n) operation, where n is the number of elements in collection.

◆ arranged_element_collection() [4/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( const arranged_element_collection< type_t, sorter_t > & collection)
inline

Default copy constructor with specified list.

Parameters
collectionThe xtd::forms::layout::arranged_element_collection which elements will be inserted from.

◆ arranged_element_collection() [5/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( arranged_element_collection< type_t, sorter_t > && collection)
inline

Move constructor with specified list.

Parameters
listThe xtd::forms::layout::arranged_element_collection which elements will be moved from.

◆ arranged_element_collection() [6/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( const base_type & collection)
inline

Copy constructor with specified base type list.

Parameters
listThe xtd::forms::layout::arranged_element_collection::base_type which elements will be inserted from.

◆ arranged_element_collection() [7/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( base_type && collection)
inline

Move constructor with specified base type list.

Parameters
listThe xtd::forms::layout::arranged_element_collection::base_type which elements will be moved from.

◆ arranged_element_collection() [8/9]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( std::initializer_list< type_t > items)
inline

Constructs the container with the contents of the specified initializer list, and allocator.

Parameters
itemsThe initializer list to initialize the elements of the container with.

◆ arranged_element_collection() [9/9]

template<typename type_t, typename sorter_t = sorter_none>
template<std::input_iterator input_iterator_t>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( input_iterator_t first,
input_iterator_t last )
inline

Constructs the container with the contents of the range [first, last).

Parameters
firstThe first iterator the range to copy the elements from.
lastThe last iterator the range to copy the elements from.
allocThe allocator to use for all memory allocations of this container.

Member Function Documentation

◆ capacity() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::capacity ( ) const -> size_type
inlinenodiscardnoexcept

Gets the total number of elements the internal data structure can hold without resizing.

Returns
Capacity of the currently allocated storage.
Exceptions
xtd::argument_out_of_range_exceptionxtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count.

◆ capacity() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::capacity ( size_type value) -> void
inline

Sets the total number of elements the internal data structure can hold without resizing.

Returns
Capacity of the currently allocated storage.
Exceptions
xtd::out_of_memoryThere is not enough memory available on the system.
xtd::argument_out_of_range_exceptionxtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count.

◆ count()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::count ( ) const -> size_type
inlinenodiscardoverridenoexcept

Gets the number of elements contained in the xtd::forms::layout::arranged_element_collection <type_t>.

Returns
The number of elements contained in the xtd::forms::layout::arranged_element_collection <type_t>.

◆ data() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::data ( ) -> pointer
inlinenodiscard

Direct access to the underlying array.

Returns
The underlying array.

◆ data() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::data ( ) const -> const_pointer
inlinenodiscard

Direct access to the underlying array.

Returns
The underlying array.

◆ items() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
const auto & xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::items ( ) const
inlinenodiscard

Returns the underlying base type items.

Returns
The underlying base type items.

◆ items() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto & xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::items ( )
inlinenodiscard

Returns the underlying base type items.

Returns
The underlying base type items.

◆ sorted() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::sorted ( ) const -> bool
inlinenodiscardvirtualnoexcept

Checks whether the container is sorted.

Returns
true if container is sorted; otherwise false.

◆ sorted() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::sorted ( bool value) -> arranged_element_collection &
inlinevirtual

Sets the container is sorted.

Parameters
valuetrue if container is sorted; otherwise false.

◆ add() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add ( const type_t & item) -> void
inlineoverride

Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.

Parameters
itemThe object to add to the xtd::forms::layout::arranged_element_collection <type_t>.

◆ add() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add ( type_t && item) -> void
inlinevirtual

Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.

Parameters
itemThe object to add to the xtd::forms::layout::arranged_element_collection <type_t>.

◆ add_range() [1/5]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add_range ( const arranged_element_collection< type_t, sorter_t > & collection) -> void
inlinevirtual

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ add_range() [2/5]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add_range ( const std::vector< type_t > & collection) -> void
inlinevirtual

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ add_range() [3/5]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add_range ( const std::initializer_list< type_t > & collection) -> void
inlinevirtual

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ add_range() [4/5]

template<typename type_t, typename sorter_t = sorter_none>
template<typename collection_t>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add_range ( collection_t && collection) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ add_range() [5/5]

template<typename type_t, typename sorter_t = sorter_none>
template<typename collection_t>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::add_range ( const collection_t & collection) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ clear()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::clear ( ) -> void
inlineoverride

Removes all items from the xtd::forms::layout::arranged_element_collection <type_t>.

Remarks
xtd::forms::layout::arranged_element_collection::count must be set to 0, and references to other objects from elements of the collection must be released.

◆ contains()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::contains ( const type_t & item) const -> bool
inlinenodiscardoverridenoexcept

Determines whether the xtd::forms::layout::arranged_element_collection <type_t> contains a specific value.

Parameters
itemThe object to locate in the xtd::forms::layout::arranged_element_collection <type_t>.
Returns
true if item is found in the xtd::forms::layout::arranged_element_collection <type_t>; otherwise, false.

◆ copy_to()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::copy_to ( xtd::array< type_t > & array,
xtd::usize array_index ) const -> void
inlineoverride

Copies the elements of the xtd::forms::layout::arranged_element_collection <type_t> to an xtd::array, starting at a particular xtd::array index.

Parameters
arrayThe one-dimensional xtd::array that is the destination of the elements copied from xtd::forms::layout::arranged_element_collection <type_t>. The xtd::array must have zero-based indexing.
array_indexThe zero-based index in array at which copying begins.
Exceptions
xtd::argument_exceptionThe number of elements in the source xtd::forms::layout::arranged_element_collection <type_t> is greater than the available space from `array_index` to the end of the destination `array`.

◆ get_enumerator()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::get_enumerator ( ) const -> xtd::collections::generic::enumerator< type_t >
inlinenodiscardoverridenoexcept

Returns an enumerator that iterates through the xtd::forms::layout::arranged_element_collection <type_t>.

Returns
A xtd::collections::generic::.enumerator for the xtd::forms::layout::arranged_element_collection <type_t>.

◆ insert() [1/3]

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert ( xtd::usize index,
const type_t & value ) -> void
inlinevirtual

Inserts specified element at specified index.

Parameters
indexThe index before which the content will be inserted.
valueThe element to insert.

Reimplemented in xtd::forms::control::control_collection.

◆ sort()

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::sort ( ) -> arranged_element_collection &
inlinevirtual

Sorts the content.

◆ remove()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::remove ( const type_t & item) -> bool
inlineoverride

Removes the first occurrence of a specific object from the xtd::forms::layout::arranged_element_collection <type_t>.

Parameters
itemThe object to remove from the xtd::forms::layout::arranged_element_collection <type_t>.
Returns
true if item was successfully removed from the xtd::forms::layout::arranged_element_collection <type_t>; otherwise, false. This method also returns false if item is not found in the original xtd::forms::layout::arranged_element_collection <type_t>.
Remarks
If type 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.
This method performs a linear search; therefore, this method is an O(n) operation, where n is xtd::forms::layout::arranged_element_collection::count.

◆ remove_at()

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::remove_at ( xtd::usize index) -> void
inlinevirtual

Erases element at specified index.

Parameters
posThe index which the content will be erased.

◆ reverse() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reverse ( ) -> arranged_element_collection &
inline

Reverses the order of the elements in the entire xtd::collections::generic::list <type_t>.

Examples
The following example demonstrates both overloads of the xtd::collections::generic::list::reverse method. The example creates a xtd::collections::generic::list <type_t> of strings and adds six strings. The xtd::collections::generic::list::reverse () method overload is used to reverse the list, and then the xtd::collections::generic::list::reverse (xtd::usize, xtd::usize) method overload is used to reverse the middle of the list, beginning with element 1 and encompassing four elements.
#include <xtd/xtd>
class example {
public:
static auto main() -> void {
auto dinosaurs = list<string> {};
dinosaurs.add("Pachycephalosaurus");
dinosaurs.add("Parasauralophus");
dinosaurs.add("Mamenchisaurus");
dinosaurs.add("Amargasaurus");
dinosaurs.add("Coelophysis");
dinosaurs.add("Oviraptor");
for (const auto& dinosaur : dinosaurs)
dinosaurs.reverse();
for (const auto& dinosaur : dinosaurs)
dinosaurs.reverse(1, 4);
for (const auto& dinosaur : dinosaurs)
}
};
startup_(example::main);
// This code produces the following output :
//
//
// Pachycephalosaurus
// Parasauralophus
// Mamenchisaurus
// Amargasaurus
// Coelophysis
// Oviraptor
//
// Oviraptor
// Coelophysis
// Amargasaurus
// Mamenchisaurus
// Parasauralophus
// Pachycephalosaurus
//
// Oviraptor
// Parasauralophus
// Mamenchisaurus
// Amargasaurus
// Coelophysis
// Pachycephalosaurus
Remarks
This method uses xtd::array::reverse to reverse the order of the elements.
This method is an O(n) operation, where n is xtd::collections::generic::list::count.

◆ reverse() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reverse ( size_type index,
size_type count ) -> arranged_element_collection &
inline

Reverses the order of the elements in the specified range.

Parameters
indexThe zero-based starting index of the range to reverse.
countThe number of elements in the range to reverse.
Exceptions
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>.
Examples
The following example demonstrates both overloads of the xtd::collections::generic::list::reverse method. The example creates a xtd::collections::generic::list <type_t> of strings and adds six strings. The xtd::collections::generic::list::reverse () method overload is used to reverse the list, and then the xtd::collections::generic::list::reverse (xtd::usize, xtd::usize) method overload is used to reverse the middle of the list, beginning with element 1 and encompassing four elements.
#include <xtd/xtd>
class example {
public:
static auto main() -> void {
auto dinosaurs = list<string> {};
dinosaurs.add("Pachycephalosaurus");
dinosaurs.add("Parasauralophus");
dinosaurs.add("Mamenchisaurus");
dinosaurs.add("Amargasaurus");
dinosaurs.add("Coelophysis");
dinosaurs.add("Oviraptor");
for (const auto& dinosaur : dinosaurs)
dinosaurs.reverse();
for (const auto& dinosaur : dinosaurs)
dinosaurs.reverse(1, 4);
for (const auto& dinosaur : dinosaurs)
}
};
startup_(example::main);
// This code produces the following output :
//
//
// Pachycephalosaurus
// Parasauralophus
// Mamenchisaurus
// Amargasaurus
// Coelophysis
// Oviraptor
//
// Oviraptor
// Coelophysis
// Amargasaurus
// Mamenchisaurus
// Parasauralophus
// Pachycephalosaurus
//
// Oviraptor
// Parasauralophus
// Mamenchisaurus
// Amargasaurus
// Coelophysis
// Pachycephalosaurus
Remarks
This method uses xtd::array::reverse to reverse the order of the elements.
This method is an O(n) operation, where n is xtd::collections::generic::list::count.

◆ to_array()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::to_array ( ) const -> xtd::array< type_t >
inlinenodiscardnoexcept

Gets an array with the elements of the container.

Returns
The array that contains elements of the container.

◆ operator=() [1/3]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator= ( const arranged_element_collection< type_t, sorter_t > & other) -> arranged_element_collection &
inline

Copy assignment operator. Replaces the contents with a copy of the contents of other.

Parameters
otherAnother container to use as data source.
Returns
This current instance.

◆ operator=() [2/3]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator= ( arranged_element_collection< type_t, sorter_t > && other) -> arranged_element_collection &
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.

Parameters
otherAnother base type container to use as data source.
Returns
This current instance.

◆ operator=() [3/3]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator= ( const std::initializer_list< type_t > & items) -> arranged_element_collection &
inline

Replaces the contents with those identified by initializer list ilist.

Parameters
itemsInitializer list to use as data source
Returns
This current instance.

◆ operator[]() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator[] ( size_type index) -> value_type &
inlinenodiscard

Access specified element.

Parameters
indexThe position of the element to return.
Returns
The requested element.

◆ operator[]() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator[] ( size_type index) const -> const value_type &
inlinenodiscard

Access specified element.

Parameters
indexThe position of the element to return.
Returns
The requested element.

◆ operator const_base_type &()

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator const_base_type & ( ) const
inlinenodiscardnoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ operator base_type &()

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator base_type & ( )
inlinenodiscardnoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ max_size()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::max_size ( ) const -> size_type
inlinenodiscardnoexcept

Returns the maximum possible number of elements.

Returns
The maximum possible number of elements.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::max_size().empty - Will be removed in version 1.2.0.

◆ at() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::at ( size_type pos) -> reference
inlinenodiscard

Access specified element with bounds checking.

Parameters
posThe position of the element to return.
Exceptions
std::out_of_rangepos is greater than arranged_element_collection::size.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::rator [] - Will be removed in version 1.2.0.

◆ at() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::at ( size_type pos) const -> const_reference
inlinenodiscard

Access specified element with bounds checking.

Parameters
posThe position of the element to return.
Exceptions
std::out_of_rangepos is greater than arranged_element_collection::size.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::rator [] - Will be removed in version 1.2.0.

◆ back() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::back ( ) -> reference
inlinenodiscard

Access the last element.

Returns
The last element.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::operator [~1_z] - Will be removed in version 1.2.0.

◆ back() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::back ( ) const -> const_reference
inlinenodiscard

Access the last element.

Returns
The last element.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::operator [~1_z] - Will be removed in version 1.2.0.

◆ crbegin()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::crbegin ( ) const -> const_reverse_iterator
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().crbegin - Will be removed in version 1.2.0.

◆ crend()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::crend ( ) const -> const_reverse_iterator
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().crend - Will be removed in version 1.2.0.

◆ front() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::front ( ) -> reference
inlinenodiscard

Access the first element.

Returns
The first element.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::operator [0] - Will be removed in version 1.2.0.

◆ front() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::front ( ) const -> const_reference
inlinenodiscard

Access the first element.

Returns
The first element.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::operator [0] - Will be removed in version 1.2.0.

◆ get_allocator()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::get_allocator ( ) const
inlinenodiscardnoexcept

Returns the associated allocator.

Returns
The associate allocator.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::count - Will be removed in version 1.2.0.

◆ emplace()

template<typename type_t, typename sorter_t = sorter_none>
template<typename ... args_t>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::emplace ( xtd::collections::generic::list< value_type >::const_iterator pos,
args_t &&... args ) -> void
inline

Inserts specified element at specified position.

Parameters
posThe iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator.
argsThe arguments to forward to the constructor of the element
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.

◆ emplace_back()

template<typename type_t, typename sorter_t = sorter_none>
template<typename ... args_t>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::emplace_back ( args_t &&... args) -> void
inline

Adds an element to the end.

Parameters
argsThe arguments to forward to the constructor of the element
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add - Will be removed in version 1.2.0.

◆ erase() [1/4]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( xtd::collections::generic::list< value_type >::iterator pos)
inline

Erases element at specified position.

Parameters
posThe iterator which the content will be erased.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.

◆ erase() [2/4]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( xtd::collections::generic::list< value_type >::const_iterator pos)
inline

Erases element at specified position.

Parameters
posThe iterator which the content will be erased.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.

◆ erase() [3/4]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( xtd::collections::generic::list< value_type >::iterator first,
xtd::collections::generic::list< value_type >::iterator last )
inline

Erases elements at specified range.

Parameters
firstThe first iterator range which the content will be erased.
firstThe last iterator range which the content will be erased.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.

◆ erase() [4/4]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( xtd::collections::generic::list< value_type >::const_iterator first,
xtd::collections::generic::list< value_type >::const_iterator last )
inline

Erases elements at specified range.

Parameters
firstThe first iterator range which the content will be erased.
firstThe last iterator range which the content will be erased.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.

◆ erase_at()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase_at ( xtd::usize index) -> void
inline

Erases element at specified index.

Parameters
posThe index which the content will be erased.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.

◆ insert() [2/3]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert ( xtd::collections::generic::list< value_type >::const_iterator pos,
const type_t & value )
inline

Inserts specified element at specified position.

Parameters
posThe iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator.
valueThe element to insert.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.

◆ insert() [3/3]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert ( xtd::collections::generic::list< value_type >::const_iterator pos,
type_t && value )
inline

Inserts specified element at specified position.

Parameters
posThe iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator.
valueThe element to insert.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.

◆ insert_at()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert_at ( xtd::usize index,
const type_t & value ) -> void
inline

Inserts specified element at specified index.

Parameters
indexThe index before which the content will be inserted.
valueThe element to insert.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.

◆ pop_back()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::pop_back ( ) -> void
inline

Removes the last element of the container.

Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::remove(count() - 1) - Will be removed in version 1.2.0.

◆ push_back() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back ( const type_t & item) -> void
inline

Adds an element to the end.

Parameters
itemThe element to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add - Will be removed in version 1.2.0.

◆ push_back() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back ( type_t && item) -> void
inline

Adds an element to the end.

Parameters
itemThe element to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add - Will be removed in version 1.2.0.

◆ push_back_range() [1/5]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( const arranged_element_collection< type_t, sorter_t > & collection) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.

◆ push_back_range() [2/5]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( const std::vector< type_t > & collection) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.

◆ push_back_range() [3/5]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( const std::initializer_list< type_t > & collection) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.

◆ push_back_range() [4/5]

template<typename type_t, typename sorter_t = sorter_none>
template<typename collection_t>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( collection_t && collection) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.

◆ push_back_range() [5/5]

template<typename type_t, typename sorter_t = sorter_none>
template<typename iterator_t>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( iterator_t begin,
iterator_t end ) -> void
inline

Adds elements to the end.

Parameters
collectionThe elements to add.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.

◆ to_vector()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::to_vector ( ) const -> std::vector< type_t >
inlinenodiscardnoexcept

Gets an array with the elements of the container.

Returns
The array that contains elements of the container.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::to_array - Will be removed in version 1.2.0.

◆ rbegin() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rbegin ( )
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().rbegin - Will be removed in version 1.2.0.

◆ rbegin() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rbegin ( ) const
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().rbegin - Will be removed in version 1.2.0.

◆ rend() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rend ( )
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().rend - Will be removed in version 1.2.0.

◆ rend() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rend ( ) const
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.
Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().rend - Will be removed in version 1.2.0.

◆ reserve()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reserve ( size_type size) -> void
inline

Reserves storage.

Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().reserve - Will be removed in version 1.2.0.

◆ shrink_to_fit()

template<typename type_t, typename sorter_t = sorter_none>
auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::shrink_to_fit ( ) -> void
inline

Reduces memory usage by freeing unused memory.

Deprecated
Replaced by xtd::forms::layout::arranged_element_collection::items().shrink_to_fit - Will be removed in version 1.2.0.

◆ on_item_added()

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::on_item_added ( xtd::usize index,
type_t & item ) -> void
inlineprotectedvirtual

Raises the xtd::forms::layout::arranged_element_collection::item_added event.

Parameters
indexThe index of the item.
itemThe item added.

◆ on_item_updated()

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::on_item_updated ( xtd::usize index,
type_t & item ) -> void
inlineprotectedvirtual

Raises the xtd::forms::layout::arranged_element_collection::item_updated event.

Parameters
indexThe index of the item.
itemThe item updated.

◆ on_item_removed()

template<typename type_t, typename sorter_t = sorter_none>
virtual auto xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::on_item_removed ( xtd::usize index,
type_t & item ) -> void
inlineprotectedvirtual

Raises the xtd::forms::layout::arranged_element_collection::item_removed event.

Parameters
indexThe index of the item.
itemThe item removed.

Reimplemented in xtd::forms::control::control_collection.

Member Data Documentation

◆ npos

template<typename type_t, typename sorter_t = sorter_none>
xtd::usize xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::npos
inlinestaticconstexpr

Represents a value that is not a valid position in a collection.

Remarks
This constant is typically used to indicate the absence of an index or a failed search operation. It is equivalent to the maximum value of xtd::usize.
Examples
auto controls = control_collection {label1, button1, choice1};
if (items.index_of(label1) == items.npos)
console::write_line("Value not found");
const auto & items() const
Returns the underlying base type items.
Definition arranged_element_collection.hpp:216
@ button1
The first button on the message box is the default button.
Definition message_dialog_default_button.hpp:24

◆ bpos

template<typename type_t, typename sorter_t = sorter_none>
xtd::usize xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::bpos
inlinestaticconstexpr

Represents the index of the first valid element in a collection.

Remarks
Unlike xtd::npos (which means "no position"), xtd::bpos points to the first accessible element of a collection. It is equivalent to 0.
Examples
auto controls = control_collection {label1, button1, choice1};
controls[bpos].width(240); // change the with of label1 to 240
controls[bpos + 1].width(120); // change the with of button1 to 120
constexpr auto bpos
Represents the index of the firsy valid element in a collection.
Definition bpos.hpp:25

◆ epos

template<typename type_t, typename sorter_t = sorter_none>
xtd::usize xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::epos
inlinestaticconstexpr

Represents the index of the last valid element in a collection.

Remarks
Unlike xtd::npos (which means "no position"), xtd::epos points to the last accessible element of a collection. It is equivalent to items.count() - 1.
Note
This constant is provided for readability and convenience. For example, items[xtd::epos] directly accesses the last element without manually subtracting one from the collection count.
Remarks
The epos is equivalent to ~1_z. With bitwise operator the code is more concise.
Examples
auto controls = control_collection {label1, button1, choice1};
controls[epos].width(240); // change the with of choice1 to 240
controls[epos - 1].width(120); // change the with of button1 to 120
constexpr xtd::usize epos
Represents the index of the last valid element in a collection.
Definition epos.hpp:33
The wollowing exemple shows the same example with bitwise operator as index.
auto controls = control_collection {label1, button1, choice1};
controls[~1_z].width(240); // change the with of choice1 to 240
controls[~2_z].width(120); // change the with of button1 to 120

◆ item_added

template<typename type_t, typename sorter_t = sorter_none>
event<arranged_element_collection, delegate<void(xtd::usize, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_added

Occurs when an item is added to the collection.

Remarks
For more information about handling events, see Handling and Raising Events.

◆ item_updated

template<typename type_t, typename sorter_t = sorter_none>
event<arranged_element_collection, delegate<void(xtd::usize, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_updated

Occurs when an item is updated in the collection.

Remarks
For more information about handling events, see Handling and Raising Events.

◆ item_removed

template<typename type_t, typename sorter_t = sorter_none>
event<arranged_element_collection, delegate<void(xtd::usize, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_removed

Occurs when an item is removed from the collection.

Remarks
For more information about handling events, see Handling and Raising Events.

The documentation for this class was generated from the following file: