xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd
collections
generic
enumerable
xtd::collections::generic::enumerable< type_t > Struct Template Reference
﹡ libraries
»
xtd.core
|
system
|
system
»
concepts
Definition
template<class type_t>
struct xtd::collections::generic::enumerable< type_t >
Represents the enumerable concept.
Definition
template
<
class
value_t>
concept
xtd::collections::generic::enumerable
=
requires
{
typename
xtd::raw_type<type_t>::value_type
;} && std::derived_from<xtd::raw_type<type_t>,
xtd::collections::generic::ienumerable<typename xtd::raw_type<type_t>::value_type
>>;
xtd::collections::generic::ienumerable
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition
ienumerable.hpp:40
xtd::collections::generic::enumerable
Definition
enumerable.hpp:17
xtd::raw_type
std::remove_cvref_t< value_t > raw_type
Represents a raw type alias equivalent to std::remove_cvref_t<value_t>.
Definition
raw_type.hpp:25
Header
#include <xtd//collections/generic/enumerable>
Namespace
xtd
Library
xtd.core
Examples
The following code shows how to use
xtd::collections::generic::enumerable
concept
#include <xtd/xtd>
auto
int_generator() ->
enumerable_generator<int>
{
co_yield
15;
co_yield
11;
co_yield
13;
co_yield
14;
co_yield
12;
}
template
<collections::
generic
::enumerable enumerable_t>
[[nodiscard]]
auto
enumerate(enumerable_t&&
enumerable
) ->
enumerable_generator<enumerable_value_type<enumerable_t>
> {
for
(
const
auto
& item :
enumerable
)
co_yield
item;
}
auto
main() ->
int
{
for
(
auto
item : enumerate(
array
{5, 1, 3, 4, 2}).select(_ * 2).order())
println
(
"{,2}"
, item);
for
(
auto
item : enumerate(list {10, 6, 8, 9, 7}).select(_ * 3).order())
println(
"{,2}"
, item);
for
(
auto
item : enumerate(int_generator()).select(_ * 4).order())
println(
"{,2}"
, item);
}
// This code produces the following output :
//
// 2
// 4
// 6
// 8
// 10
// 18
// 21
// 24
// 27
// 30
// 44
// 48
// 52
// 56
// 60
xtd::array
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition
array.hpp:64
xtd::collections::generic::enumerable_generator
Represents an enumerable enumerable_generator.
Definition
enumerable_generator.hpp:24
xtd::println
auto println(FILE *file) -> void
Writes the current line terminator to the file output stream using the specified format information.
Definition
println.hpp:14
The documentation for this struct was generated from the following file:
xtd.core/include/xtd/collections/generic/
enumerable_.hpp
Generated on
for xtd by
Gammasoft
. All rights reserved.