xtd 0.2.0
xtd::collections::generic Namespace Reference

Definition

The xtd::collections::generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections.

Namespaces

namespace  extensions
 The xtd::extensions namespace contains interface extensions.
 
namespace  helpers
 The xtd::collections::generic::helpers namespace contains helpers for generic collections, sush as comparer, equator an hasher structs.
 

Classes

class  comparer
 Provides a base class for implementations of the xtd::collections::generic::icomparer <type_t> generic interface. More...
 
class  dictionary
 Represents a collection of keys and values. More...
 
class  empty_comparer
 Provides an empty comparer class. More...
 
struct  enumerator
 Supports a simple iteration over a generic collection. More...
 
struct  enumerator<>
 Supports a simple iteration over a generic collection. More...
 
class  equality_comparer
 Provides a base class for implementations of the xtd::collections::generic::iequality_comparer <type_t> generic interface. More...
 
class  icomparer
 Exposes a method that compares two objects. More...
 
class  idictionary
 Represents a generic collection of key/value pairs. More...
 
class  ienumerable
 Exposes the enumerator, which supports a simple iteration over a collection of a specified type. More...
 
class  ienumerator
 Supports a simple iteration over a generic collection. More...
 
class  iequality_comparer
 Defines methods to support the comparison of objects for equality. More...
 
class  iset
 Provides the base interface for the abstraction of sets. More...
 
class  key_not_found_exception
 The exception that is thrown when the key specified for accessing an element in a collection does not match any key in the collection. More...
 
struct  key_value_pair
 Defines a key/value pair that can be set or retrieved. More...
 
struct  key_value_pair<>
 Defines a key/value pair that can be set or retrieved. More...
 
class  list
 Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists. More...
 

Alias

template<class type_t, class hasher_t = xtd::collections::generic::helpers::hasher<type_t>, class equator_t = xtd::collections::generic::helpers::equator<type_t>, class allocator_t = xtd::collections::generic::helpers::allocator<type_t>>
using hash_set
 Represents a set of values.
 
template<class type_t, class allocator_t = xtd::collections::generic::helpers::allocator<type_t>>
using linked_list
 Represents a doubly linked list.
 
template<class type_t, class container_t = std::deque<type_t>>
using queue
 Represents a collection of objects that is maintained in sorted order.
 
template<class key_t, class value_t, class lesser_t = helpers::lesser<key_t>, class allocator_t = helpers::allocator<std::pair<const key_t, value_t>>>
using sorted_dictionary
 Represents a collection of key/value pairs that are sorted on the key.
 
template<class key_t, class value_t, class allocator_t = helpers::allocator<std::pair<const key_t, value_t>>>
using sorted_list
 Represents a collection of key/value pairs that are sorted by the keys and are accessible by key and by index.
 
template<class type_t, class lesser_t = xtd::collections::generic::helpers::lesser<type_t>, class allocator_t = xtd::collections::generic::helpers::allocator<type_t>>
using sorted_set
 Represents a collection of objects that is maintained in sorted order.
 
template<class type_t, class container_t = std::deque<type_t>>
using stack
 Represents a variable size last-in-first-out (LIFO) collection of instances of the same specified type.
 
template<class type_t>
using type_to_list_t
 Represents the type to list type.
 

Public Methods

virtual bool remove (const type_t &item)=0
 

Public Operators

Gets the element at the specified index. /

/

/ /

Parameters
indexThe zero-based index of the element to get. /
Remarks
This operator provides the ability to access a specific element in the collection by using the following syntax: my_collection[index]. virtual const type_t& operator [](xtd::size index) const = 0; / Sets the element at the specified index. /
Parameters
indexThe zero-based index of the element to set. /
Remarks
This operator provides the ability to access a specific element in the collection by using the following syntax: my_collection[index].
virtual type_t & operator[] (xtd::size index)=0
 

Function Documentation

◆ remove()

virtual bool xtd::collections::generic::remove ( const type_t & item)
pure virtual
Exceptions
xtd::not_supported_exceptionThe xtd::collections::generic::icollection <type_t> is read-only.
Remarks
Implementations can vary in how they determine equality of objects; for example, xtd::collections::generic::list <type_t> uses xtd::collections::generic::compoarer <type_t>::default_comparer, whereas, xtd::collections::generic::dictionary <key_t, value_t> allows the user to specify the xtd::collections::generic::icompoarer <type_t> implementation to use for comparing keys.
In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.