xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::extensions::collection_common< type_t, collection_t > Class Template Reference

Definition

template<class type_t, class collection_t>
class xtd::collections::generic::extensions::collection_common< type_t, collection_t >

Internal collection common definition.

Definition
template<class type_t, class collection_t>
class collection_operator;
Header
#include <xtd/collections/generic/extensions/collection_common
Namespace
xtd
Library
xtd.core
Warning
Internal use only for xtd::icollection interfece.

Public Properties

virtual bool empty () const noexcept
 Checks whether the container is empty.
 
virtual xtd::size size () const noexcept
 Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
 

Public Operators

virtual collection_t & operator<< (const type_t &item)
 The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>.
 
virtual collection_t & operator<< (type_t &&item)
 The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>.
 
virtual collection_t & operator>> (const type_t &item)
 The shift right operator removes the first occurrence of a specific object from the xtd::collections::generic::icollection <type_t>.
 

Member Function Documentation

◆ empty()

template<class type_t, class collection_t>
virtual bool xtd::collections::generic::extensions::collection_common< type_t, collection_t >::empty ( ) const
inlinevirtualnoexcept

Checks whether the container is empty.

Returns
true if container is empty; otherwise false.

◆ size()

template<class type_t, class collection_t>
virtual xtd::size xtd::collections::generic::extensions::collection_common< type_t, collection_t >::size ( ) const
inlinevirtualnoexcept

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>.

◆ operator<<() [1/2]

template<class type_t, class collection_t>
virtual collection_t & xtd::collections::generic::extensions::collection_common< type_t, collection_t >::operator<< ( const type_t & item)
inlinevirtual

The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>.

Parameters
itemThe object to add to the xtd::collections::generic::icollection <type_t>.
Exceptions
xtd::not_supported_exceptionThe xtd::collections::generic::icollection <type_t> is read-only.

◆ operator<<() [2/2]

template<class type_t, class collection_t>
virtual collection_t & xtd::collections::generic::extensions::collection_common< type_t, collection_t >::operator<< ( type_t && item)
inlinevirtual

The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>.

Parameters
itemThe object to add to the xtd::collections::generic::icollection <type_t>.
Exceptions
xtd::not_supported_exceptionThe xtd::collections::generic::icollection <type_t> is read-only.

◆ operator>>()

template<class type_t, class collection_t>
virtual collection_t & xtd::collections::generic::extensions::collection_common< type_t, collection_t >::operator>> ( const type_t & item)
inlinevirtual

The shift right operator removes the first occurrence of a specific object from the xtd::collections::generic::icollection <type_t>.

Parameters
itemThe object to remove from the xtd::collections::generic::icollection <type_t>.
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.

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