xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::iset< type_t > Class Template Referenceabstract
Inheritance diagram for xtd::collections::generic::iset< type_t >:
xtd::collections::generic::ienumerable< type_t > xtd::interface xtd::collections::generic::ienumerable_abstract xtd::collections::generic::extensions::enumerable_iterators< type_t, xtd::collections::generic::ienumerable< type_t > > xtd::collections::generic::extensions::enumerable< ienumerable< type_t >, type_t > xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >

Definition

template<class type_t>
class xtd::collections::generic::iset< type_t >

Provides the base interface for the abstraction of sets.

Definition
template<class type_t>
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
Provides the base interface for the abstraction of sets.
Definition iset.hpp:33
Header
#include <xtd/collections/generic/iset>
Namespace
xtd::collections::generic
Library
xtd.core
Remarks
This interface provides methods for implementing sets, which are collections that have unique elements and specific operations. The xtd::collections::generic::hash_set <type_t> and xtd::collections::generic::sorted_set <type_t> collections implement this interface.

Public Aliases

using key_type
 Represents the set key type.
 
using value_type
 Represents the set value type.
 
using iterator
 Represents the iterator of xtd::collections::generic::ienumerable value type.
 
using const_iterator
 Represents the const iterator of xtd::collections::generic::ienumerable value type.
 

Public Properties

virtual auto count () const noexcept -> xtd::size=0
 Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
 
virtual auto is_read_only () const noexcept -> bool=0
 Gets a value indicating whether the xtd::collections::generic::icollection <type_t> is read-only.
 
virtual auto is_synchronized () const noexcept -> bool=0
 Gets a value indicating whether access to the xtd::collections::generic::icollection <type_t> is synchronized (thread safe).
 
virtual auto sync_root () const noexcept -> const xtd::object &=0
 Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>.
 

Public Methods

virtual auto add (const type_t &item) noexcept -> bool=0
 Adds an element to the current set and returns a value to indicate if the element was successfully added.
 
virtual auto clear () -> void=0
 Removes all items from the xtd::collections::generic::iset <type_t>.
 
virtual auto contains (const type_t &item) const noexcept -> bool=0
 Determines whether the xtd::collections::generic::iset <type_t> contains a specific value.
 
virtual auto copy_to (xtd::array< type_t > &array, xtd::size array_index) const -> void=0
 Copies the elements of the xtd::collections::generic::iset <type_t> to an xtd::array, starting at a particular xtd::array index.
 
virtual auto except_with (const xtd::collections::generic::ienumerable< type_t > &other) noexcept -> void=0
 Removes all elements in the specified collection from the current set.
 
virtual auto intersect_with (const xtd::collections::generic::ienumerable< type_t > &other) noexcept -> void=0
 Modifies the current set so that it contains only elements that are also in a specified collection.
 
virtual auto is_proper_subset_of (const xtd::collections::generic::ienumerable< type_t > &other) const noexcept -> bool=0
 Determines whether the current set is a proper (strict) superset of a specified collection.
 
virtual auto is_proper_superset_of (const xtd::collections::generic::ienumerable< type_t > &other) const noexcept -> bool=0
 Determines whether the current set is a proper (strict) superset of a specified collection.
 
virtual auto is_subset_of (const xtd::collections::generic::ienumerable< type_t > &other) const noexcept -> bool=0
 Determines whether a set is a subset of a specified collection.
 
virtual auto is_superset_of (const xtd::collections::generic::ienumerable< type_t > &other) const noexcept -> bool=0
 Determines whether a set is a superset of a specified collection.
 
virtual auto overlaps (const xtd::collections::generic::ienumerable< type_t > &other) const noexcept -> bool=0
 Determines whether the current set overlaps with the specified collection.
 
virtual auto remove (const type_t &item) -> bool=0
 Removes the first occurrence of a specific object from the xtd::collections::generic::iset <type_t>.
 
virtual auto set_equals (const xtd::collections::generic::ienumerable< type_t > &other) const noexcept -> bool=0
 Determines whether the current set and the specified collection contain the same elements.
 
virtual auto symetric_excep_with (const xtd::collections::generic::ienumerable< type_t > &other) noexcept -> void=0
 Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.
 
virtual auto union_with (const xtd::collections::generic::ienumerable< type_t > &other) noexcept -> void=0
 Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.
 

Additional Inherited Members

using value_type
 Represents the xtd::collections::generic::ienumerable value type.
 
using iterator
 Represents the iterator of xtd::collections::generic::ienumerable value type.
 
using const_iterator
 Represents the const iterator of xtd::collections::generic::ienumerable value type.
 
using iterator
 Represents the iterator of enumerable value type.
 
using const_iterator
 Represents the const iterator of enumerable value type.
 
using enumerable_type
 Represents the ienumerable enumerable type.
 
using source_type
 Represents the ienumerable source type.
 
using ienumerable
 Represents the ienumerable value type.
 
using list
 Represents the list value type.
 
virtual auto get_enumerator () const -> xtd::collections::generic::enumerator< type_t >=0
 Returns an enumerator that iterates through a collection.
 
virtual auto begin () const -> const_iterator
 Returns an iterator to the first element of the enumerable.
 
virtual auto begin () -> iterator
 Returns an iterator to the first element of the enumerable.
 
virtual auto cbegin () const -> const_iterator
 Returns an iterator to the first element of the enumerable.
 
virtual auto cend () const -> const_iterator
 Returns an iterator to the element following the last element of the enumerable.
 
virtual auto end () const -> const_iterator
 Returns an iterator to the element following the last element of the enumerable.
 
virtual auto end () -> iterator
 Returns an iterator to the element following the last element of the enumerable.
 
auto aggregate (const std::function< type_t(const type_t &, const type_t &)> &func) const -> type_t
 Applies an accumulator function over a sequence.
 
auto aggregate (const type_t &seed, const std::function< type_t(const type_t &, const type_t &)> &func) const -> type_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
 
auto aggregate (const accumulate_t &seed, const std::function< accumulate_t(const accumulate_t &, const type_t &)> &func) const -> accumulate_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
 
auto aggregate (const type_t &seed, const std::function< type_t(const type_t &, const type_t &)> &func, const std::function< type_t(const type_t &)> &result_selector) const -> type_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
 
auto aggregate (const accumulate_t &seed, const std::function< accumulate_t(const accumulate_t &, const type_t &)> &func, const std::function< result_t(const accumulate_t &)> &result_selector) const -> result_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
 
auto all (const std::function< bool(const type_t &)> &predicate) const -> bool
 Determines whether all elements of a sequence satisfy a condition.
 
auto any () const noexcept -> bool
 Determines whether a sequence contains any elements.
 
auto any (const std::function< bool(const type_t &)> &predicate) const -> bool
 Determines whether any element of a sequence satisfies a condition.
 
auto append (const type_t &element) const noexcept
 Appends a value to the end of the sequence.
 
auto as_enumerable () const noexcept
 Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
 
auto average () const noexcept
 Computes the average of a sequence of source_t values.
 
auto cast () const noexcept
 Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
 
auto chunk (size_t size) const
 Splits the elements of a sequence into chunks of size at most size.
 
auto concat (const ienumerable< type_t > &second) const noexcept
 Concatenates two sequences.
 
auto contains (const type_t &value) const noexcept -> bool
 Determines whether a sequence contains a specified element by using the default equality comparer.
 
auto contains (const type_t &value, const xtd::collections::generic::iequality_comparer< type_t > &comparer) const noexcept -> bool
 Determines whether a sequence contains a specified element by using a specified equality comparer.
 
auto count () const noexcept -> xtd::size
 Returns the number of elements in current sequence.
 
auto count (const std::function< bool(const type_t &)> &predicate) const noexcept -> xtd::size
 Returns a number that represents how many elements in the specified sequence satisfy a condition.
 
auto count (const type_t &value) const noexcept -> xtd::size
 Returns the number of elements with the specified value.
 
auto count_by (const std::function< key_t(const type_t &)> &key_selector) const noexcept
 Returns the count of elements in the current sequence grouped by key.
 
auto count_by (const std::function< key_t(const type_t &)> &key_selector, const iequality_comparer< key_t > &key_comparer) const noexcept
 Returns the count of elements in the current sequence grouped by key.
 
auto default_if_empty () const noexcept
 Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty.
 
auto default_if_empty (const type_t &default_value) const noexcept
 Returns the elements of the specified sequence or the specified value in a singleton collection if the current sequence is empty.
 
auto distinct () const noexcept
 Returns distinct elements from a sequence by using the default equality comparer to compare values.
 
auto distinct (const xtd::collections::generic::iequality_comparer< type_t > &comparer) const noexcept
 Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_comparer <type_t> to compare values.
 
auto first_or_default (const std::function< bool(const type_t &)> &predicate, const type_t &default_value) const noexcept -> type_t
 Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found.
 
auto first_or_default (const std::function< bool(const type_t &)> &predicate) const noexcept -> type_t
 Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
 
auto first_or_default (const type_t default_value) const noexcept -> type_t
 Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
 
auto first_or_default () const noexcept -> type_t
 Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
 
auto order ()
 Sorts the elements of a sequence in ascending order.
 
auto order (const xtd::collections::generic::icomparer< type_t > &comparer)
 Sorts the elements of a sequence in ascending order.
 
auto order_by (const std::function< type_t(const type_t &)> &key_selector) const
 Sorts the elements of a sequence in ascending order according to a key.
 
auto order_by (const std::function< key_t(const type_t &)> &key_selector) const
 Sorts the elements of a sequence in ascending order according to a key.
 
auto order_by_descending (const std::function< key_t(const type_t &)> &key_selector) const
 Sorts the elements of a sequence in descending order according to a key.
 
auto order_by_descending (const std::function< type_t(const type_t &)> &key_selector) const
 Sorts the elements of a sequence in descending order according to a key.
 
auto select (const std::function< result_t(const type_t &)> &selector) const
 Projects each element of a sequence into a new form.
 
auto select (const std::function< type_t(const type_t &)> &selector) const
 Projects each element of a sequence into a new form.
 
auto select (const std::function< result_t(const type_t &, size_t index)> &selector) const
 Projects each element of a sequence into a new form by incorporating the element's index.
 
auto select (const std::function< type_t(const type_t &, size_t index)> &selector) const
 Projects each element of a sequence into a new form by incorporating the element's index.
 
auto to_array () const noexcept -> xtd::array< type_t >
 Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
 
auto to_list () const noexcept -> list< type_t >
 Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>.
 
auto where (const std::function< bool(const type_t &)> &predicate) const
 Filters a sequence of values based on a predicate.
 
auto where (const std::function< bool(const type_t &, size_t)> &predicate) const
 Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
 
static auto to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_const_iterator (typename source_collection_t::const_iterator &value, source_collection_t &source_collection, target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::const_iterator &value, source_collection_t &source_collection, target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::iterator &value, source_collection_t &source_collection, target_collection_t &target_collection) noexcept -> typename target_collection_t::iterator
 Converts source iterator to target iterator.
 

Member Typedef Documentation

◆ key_type

template<class type_t>
using xtd::collections::generic::iset< type_t >::key_type

Represents the set key type.

◆ value_type

template<class type_t>
using xtd::collections::generic::iset< type_t >::value_type

Represents the set value type.

◆ iterator

template<class type_t>
using xtd::collections::generic::iset< type_t >::iterator

Represents the iterator of xtd::collections::generic::ienumerable value type.

◆ const_iterator

template<class type_t>
using xtd::collections::generic::iset< type_t >::const_iterator

Represents the const iterator of xtd::collections::generic::ienumerable value type.

Member Function Documentation

◆ count()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::count ( ) const -> xtd::size
pure virtualnoexcept

Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.

Returns
The number of elements contained in the xtd::collections::generic::icollection <type_t>.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ is_read_only()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::is_read_only ( ) const -> bool
pure virtualnoexcept

Gets a value indicating whether the xtd::collections::generic::icollection <type_t> is read-only.

Returns
true if the xtd::collections::generic::icollection <type_t> is read-only; otherwise, false.
Remarks
A collection that is read-only does not allow the addition or removal of elements after the collection is created. Note that read-only in this context does not indicate whether individual elements of the collection can be modified, since the xtd::collections::generic::icollection <type_t> interface only supports addition and removal operations. For example, the xtd::collections::generic::icollection::is_read_only property of an array that is cast or converted to an xtd::collections::generic::icollection <type_t> object returns true, even though individual array elements can be modified.

◆ is_synchronized()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::is_synchronized ( ) const -> bool
pure virtualnoexcept

Gets a value indicating whether access to the xtd::collections::generic::icollection <type_t> is synchronized (thread safe).

Returns
true if access to the xtd::collections::generic::icollection <type_t> is synchronized (thread safe); otherwise, false.
Remarks
xtd::collections::generic::icollection::sync_root returns an object, which can be used to synchronize access to the xtd::collections::generic::icollection <type_t>.
Most collection classes in the xtd::collections namespace also implement a synchronized method, which provides a synchronized wrapper around the underlying collection.
Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
The following code example shows how to lock the collection using the xtd::collections::generic::icollection::sync_root property during the entire enumeration.
icollection& my_collection = some_collection;
lock_(my_collection.sync_root()) {
for (auto item : my_collection) {
// Insert your code here.
}
}
#define lock_(object)
The lock_ keyword marks a statement block as a critical section by obtaining the mutual-exclusion loc...
Definition lock.hpp:67

◆ sync_root()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::sync_root ( ) const -> const xtd::object &
pure virtualnoexcept

Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>.

Returns
An object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>.
Remarks
For collections whose underlying store is not publicly available, the expected implementation is to return the current instance. Note that the pointer to the current instance might not be sufficient for collections that wrap other collections; those should return the underlying collection's sync_root property.
Most collection classes in the xts::.collections namespace also implement a synchronized method, which provides a synchronized wrapper around the underlying collection. However, derived classes can provide their own synchronized version of the collection using the xtd::collections::generic::icollection::sync_root property. The synchronizing code must perform operations on the xtd::collections::generic::icollection::sync_root property of the collection, not directly on the collection. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the collection instance.
In the absence of a synchronized method on a collection, the expected usage for the xtd::collections::generic::icollection::sync_root looks as follows:
icollection& my_collection = some_collection;
lock_(my_collection.sync_root()) {
// Some operation on the collection, which is now thread safe.
}
@encode
@remarks Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
@remarks The following code example shows how to lock the collection using the xtd::collections::generic::icollection::sync_root property during the entire enumeration.
@code
icollection& my_collection = some_collection;
lock_(my_collection.sync_root()) {
for (auto item : my_collection) {
// Insert your code here.
}
}
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:29
bool is(xtd::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
@ other
The operating system is other.
Definition platform_id.hpp:60
@ a
The A key.
Definition console_key.hpp:88
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:38

◆ add()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::add ( const type_t & item) -> bool
pure virtualnoexcept

Adds an element to the current set and returns a value to indicate if the element was successfully added.

Parameters
itemThe element to add to the set.
Returns
true if the element is added to the set; false if the element is already in the set.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ clear()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::clear ( ) -> void
pure virtual

Removes all items from the xtd::collections::generic::iset <type_t>.

Exceptions
xtd::not_supported_exceptionThe xtd::collections::generic::iset <type_t> is read-only.
Remarks
xtd::collections::generic::iset::count must be set to 0, and references to other objects from elements of the collection must be released.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ contains()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::contains ( const type_t & item) const -> bool
pure virtualnoexcept

Determines whether the xtd::collections::generic::iset <type_t> contains a specific value.

Parameters
itemThe object to locate in the xtd::collections::generic::iset <type_t>.
Returns
true if item is found in the xtd::collections::generic::iset <type_t>; otherwise, false.
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.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ copy_to()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::copy_to ( xtd::array< type_t > & array,
xtd::size array_index ) const -> void
pure virtual

Copies the elements of the xtd::collections::generic::iset <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::collections::generic::iset <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::collections::generic::iset <type_t> is greater than the available space from `array_index` to the end of the destination `array`.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ except_with()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::except_with ( const xtd::collections::generic::ienumerable< type_t > & other) -> void
pure virtualnoexcept

Removes all elements in the specified collection from the current set.

Parameters
otherThe collection of items to remove from the set.
Remarks
This method is an O(n) operation, where n is the number of elements in the other parameter.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ intersect_with()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::intersect_with ( const xtd::collections::generic::ienumerable< type_t > & other) -> void
pure virtualnoexcept

Modifies the current set so that it contains only elements that are also in a specified collection.

Parameters
otherThe collection to compare to the current set.
Remarks
This method ignores any duplicate elements in other.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ is_proper_subset_of()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::is_proper_subset_of ( const xtd::collections::generic::ienumerable< type_t > & other) const -> bool
pure virtualnoexcept

Determines whether the current set is a proper (strict) superset of a specified collection.

Parameters
otherThe collection to compare to the current set.
Returns
true if the current set is a proper superset of other; otherwise, false.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ is_proper_superset_of()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::is_proper_superset_of ( const xtd::collections::generic::ienumerable< type_t > & other) const -> bool
pure virtualnoexcept

Determines whether the current set is a proper (strict) superset of a specified collection.

Parameters
otherThe collection to compare to the current set.
Returns
true if the current set is a proper superset of other; otherwise, false.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ is_subset_of()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::is_subset_of ( const xtd::collections::generic::ienumerable< type_t > & other) const -> bool
pure virtualnoexcept

Determines whether a set is a subset of a specified collection.

Parameters
otherThe collection to compare to the current set.
Returns
true if the current set is a subset of other; otherwise, false.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ is_superset_of()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::is_superset_of ( const xtd::collections::generic::ienumerable< type_t > & other) const -> bool
pure virtualnoexcept

Determines whether a set is a superset of a specified collection.

Parameters
otherThe collection to compare to the current set.
Returns
true if the current set is a superset of other; otherwise, false.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ overlaps()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::overlaps ( const xtd::collections::generic::ienumerable< type_t > & other) const -> bool
pure virtualnoexcept

Determines whether the current set overlaps with the specified collection.

Parameters
otherThe collection to compare to the current set.
Returns
true if the current set and other share at least one common element; otherwise, false.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ remove()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::remove ( const type_t & item) -> bool
pure virtual

Removes the first occurrence of a specific object from the xtd::collections::generic::iset <type_t>.

Parameters
itemThe object to remove from the xtd::collections::generic::iset <type_t>.
Returns
true if item was successfully removed from the xtd::collections::generic::iset <type_t>; otherwise, false. This method also returns false if item is not found in the original xtd::collections::generic::iset <type_t>.
Exceptions
xtd::not_supported_exceptionThe xtd::collections::generic::iset <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.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ set_equals()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::set_equals ( const xtd::collections::generic::ienumerable< type_t > & other) const -> bool
pure virtualnoexcept

Determines whether the current set and the specified collection contain the same elements.

Parameters
otherThe collection to compare to the current set.
Returns
true if the current set is equal to other; otherwise, false.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ symetric_excep_with()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::symetric_excep_with ( const xtd::collections::generic::ienumerable< type_t > & other) -> void
pure virtualnoexcept

Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.

Parameters
otherThe collection to compare to the current set.
Remarks
Any duplicate elements in other are ignored.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.

◆ union_with()

template<class type_t>
virtual auto xtd::collections::generic::iset< type_t >::union_with ( const xtd::collections::generic::ienumerable< type_t > & other) -> void
pure virtualnoexcept

Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.

Parameters
otherThe collection to compare to the current set.
Remarks
Any duplicate elements in other are ignored.

Implemented in xtd::collections::generic::hash_set< type_t, hasher_t, equator_t, allocator_t >.


The documentation for this class was generated from the following file:
  • xtd.core/include/xtd/collections/generic/iset.hpp