Projection
select
Applies a transform
function to each element of the range, producing new
elements (of a potentially different type).
The resulting range will have the same number of elements as the range itself.
transform
must be a function that takes the range's element as input, and produces
a new value, i.e. \(f(x) \mapsto y\), where y
will be the type of element contained
in the new range.
Example | |
---|---|
select_to_string
Maps the elements of a range to a string using std::to_string()
.
The resulting string type is std::string
, unless LINQ_NO_STL_CONTAINERS
is enabled.
If so, then the string type has to be specified explicitly, as a template type argument.
int_base
specifies the decimal base for integral input valuesfloat_format
specified the format for floating-point input values
#ifdef LINQ_NO_STL_CONTAINERS
template <typename StringType>
#endif
constexpr auto select_to_string( int int_base = 10,
std::chars_format float_format = std::chars_format::general ) const;
Example | |
---|---|
select_many
Applies a transform
function to the range's elements that extracts a subrange from each element, i.e. \(f(x) \mapsto Range\).
Produces a flattened range that combines all extracted ranges sequentially.