xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t > Class Template Reference
Inheritance diagram for xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >:
xtd::collections::generic::ienumerable< xtd::any_object >

Definition

template<class type_t, class enumerable_t>
class xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >

Internal enumerable iterators definition.

Definition
template<class type_t, class enumerable_t>
Internal enumerable iterators definition.
Definition enumerable_iterators.hpp:49
Header
#include <xtd/collections/generic/extensions/enumerable_iterators>
Namespace
xtd::collections::generic
Library
xtd.core
Remarks
The xtd::collections::generic::extensions::enumerable_iterators <type_t> class is use to hide the complexity of c++ std::iterator.
The objective is for any collection inheriting from the xtd::collections::generic::ienumerable <type_t> interface to provide the iterator and const_iterator types and begin and end methods needed to be able to iterate the collection as for example :
auto parts = part_collection {};
parts.add(part {"item one", guid::new_guid()});
// ...
parts.add(part {"item n", guid::new_guid()}});
for (auto part : parts)
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static guid new_guid() noexcept
Initializes a new instance of the xtd::guid structure.
Warning
Internal use only for xtd::collections::generic::ienumerable interfece.

Public Aliases

using iterator
 Represents the iterator of enumerable value type.
 
using const_iterator
 Represents the const iterator of enumerable value type.
 

Public Methods

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.
 

Public Static Methods

template<class source_collection_t, class target_collection_t>
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.
 
template<class source_collection_t, class target_collection_t>
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.
 
template<class source_collection_t, class target_collection_t>
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.
 
template<class source_collection_t, class target_collection_t>
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.
 
template<class source_collection_t, class target_collection_t>
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.
 
template<class source_collection_t, class target_collection_t>
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

◆ iterator

template<class type_t, class enumerable_t>
using xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::iterator

Represents the iterator of enumerable value type.

◆ const_iterator

template<class type_t, class enumerable_t>
using xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::const_iterator

Represents the const iterator of enumerable value type.

Member Function Documentation

◆ begin() [1/2]

template<class type_t, class enumerable_t>
virtual auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::begin ( ) const -> const_iterator
inlinevirtual

Returns an iterator to the first element of the enumerable.

Returns
Iterator to the first element.

◆ begin() [2/2]

template<class type_t, class enumerable_t>
virtual auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::begin ( ) -> iterator
inlinevirtual

Returns an iterator to the first element of the enumerable.

Returns
Iterator to the first element.

◆ cbegin()

template<class type_t, class enumerable_t>
virtual auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::cbegin ( ) const -> const_iterator
inlinevirtual

Returns an iterator to the first element of the enumerable.

Returns
Iterator to the first element.

◆ cend()

template<class type_t, class enumerable_t>
virtual auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::cend ( ) const -> const_iterator
inlinevirtual

Returns an iterator to the element following the last element of the enumerable.

Returns
Iterator to the element following the last element.

◆ end() [1/2]

template<class type_t, class enumerable_t>
virtual auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::end ( ) const -> const_iterator
inlinevirtual

Returns an iterator to the element following the last element of the enumerable.

Returns
Iterator to the element following the last element.

◆ end() [2/2]

template<class type_t, class enumerable_t>
virtual auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::end ( ) -> iterator
inlinevirtual

Returns an iterator to the element following the last element of the enumerable.

Returns
Iterator to the element following the last element.

◆ to_const_iterator() [1/2]

template<class type_t, class enumerable_t>
template<class source_collection_t, class target_collection_t>
static auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::to_const_iterator ( typename source_collection_t::const_iterator & value,
const source_collection_t & source_collection,
const target_collection_t & target_collection ) -> typename target_collection_t::const_iterator
inlinestaticnoexcept

Converts source iterator to target iterator.

Parameters
valueThe source iterator to convert.
sourceThe source collection from which the source iterator originates.
target_collectionThe target collection from which the target iterator originates.
Returns
The converted target iterator.
Remarks
This converter is used only to convert a source iterator position into a target iterator position.
Note
This converter does not check the validity and consistency of the data in the various collections; it is up to the user to ensure this.
Remarks
The distance to move the target iterator is calculated with std::distance(source_collection.begin(), value);. Then simply move the target iterator from target_collection.begin();.

◆ to_const_iterator() [2/2]

template<class type_t, class enumerable_t>
template<class source_collection_t, class target_collection_t>
static auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::to_const_iterator ( typename source_collection_t::const_iterator & value,
source_collection_t & source_collection,
target_collection_t & target_collection ) -> typename target_collection_t::const_iterator
inlinestaticnoexcept

Converts source iterator to target iterator.

Parameters
valueThe source iterator to convert.
sourceThe source collection from which the source iterator originates.
target_collectionThe target collection from which the target iterator originates.
Returns
The converted target iterator.
Remarks
This converter is used only to convert a source iterator position into a target iterator position.
Note
This converter does not check the validity and consistency of the data in the various collections; it is up to the user to ensure this.
Remarks
The distance to move the target iterator is calculated with std::distance(source_collection.begin(), value);. Then simply move the target iterator from target_collection.begin();.

◆ to_iterator() [1/4]

template<class type_t, class enumerable_t>
template<class source_collection_t, class target_collection_t>
static auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::to_iterator ( typename source_collection_t::const_iterator & value,
const source_collection_t & source_collection,
const target_collection_t & target_collection ) -> typename target_collection_t::const_iterator
inlinestaticnoexcept

Converts source iterator to target iterator.

Parameters
valueThe source iterator to convert.
sourceThe source collection from which the source iterator originates.
target_collectionThe target collection from which the target iterator originates.
Returns
The converted target iterator.
Remarks
This converter is used only to convert a source iterator position into a target iterator position.
Note
This converter does not check the validity and consistency of the data in the various collections; it is up to the user to ensure this.
Remarks
The distance to move the target iterator is calculated with std::distance(source_collection.begin(), value);. Then simply move the target iterator from target_collection.begin();.

◆ to_iterator() [2/4]

template<class type_t, class enumerable_t>
template<class source_collection_t, class target_collection_t>
static auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::to_iterator ( typename source_collection_t::iterator & value,
const source_collection_t & source_collection,
const target_collection_t & target_collection ) -> typename target_collection_t::iterator
inlinestaticnoexcept

Converts source iterator to target iterator.

Parameters
valueThe source iterator to convert.
sourceThe source collection from which the source iterator originates.
target_collectionThe target collection from which the target iterator originates.
Returns
The converted target iterator.
Remarks
This converter is used only to convert a source iterator position into a target iterator position.
Note
This converter does not check the validity and consistency of the data in the various collections; it is up to the user to ensure this.
Remarks
The distance to move the target iterator is calculated with std::distance(source_collection.begin(), value);. Then simply move the target iterator from target_collection.begin();.

◆ to_iterator() [3/4]

template<class type_t, class enumerable_t>
template<class source_collection_t, class target_collection_t>
static auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::to_iterator ( typename source_collection_t::const_iterator & value,
source_collection_t & source_collection,
target_collection_t & target_collection ) -> typename target_collection_t::const_iterator
inlinestaticnoexcept

Converts source iterator to target iterator.

Parameters
valueThe source iterator to convert.
sourceThe source collection from which the source iterator originates.
target_collectionThe target collection from which the target iterator originates.
Returns
The converted target iterator.
Remarks
This converter is used only to convert a source iterator position into a target iterator position.
Note
This converter does not check the validity and consistency of the data in the various collections; it is up to the user to ensure this.
Remarks
The distance to move the target iterator is calculated with std::distance(source_collection.begin(), value);. Then simply move the target iterator from target_collection.begin();.

◆ to_iterator() [4/4]

template<class type_t, class enumerable_t>
template<class source_collection_t, class target_collection_t>
static auto xtd::collections::generic::extensions::enumerable_iterators< type_t, enumerable_t >::to_iterator ( typename source_collection_t::iterator & value,
source_collection_t & source_collection,
target_collection_t & target_collection ) -> typename target_collection_t::iterator
inlinestaticnoexcept

Converts source iterator to target iterator.

Parameters
valueThe source iterator to convert.
sourceThe source collection from which the source iterator originates.
target_collectionThe target collection from which the target iterator originates.
Returns
The converted target iterator.
Remarks
This converter is used only to convert a source iterator position into a target iterator position.
Note
This converter does not check the validity and consistency of the data in the various collections; it is up to the user to ensure this.
Remarks
The distance to move the target iterator is calculated with std::distance(source_collection.begin(), value);. Then simply move the target iterator from target_collection.begin();.

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