E.V.E
v2023.02.15
Loading...
Searching...
No Matches

Detailed Description

Converts every part of a zip to one type.

Variables

template<typename T>
auto eve::algo::force_type = (force_type_key = std::type_identity<T>{})

Variable Documentation

◆ force_type

template<typename T>
auto eve::algo::force_type = (force_type_key = std::type_identity<T>{})
Header file #include <eve/module/algo.hpp>
namespace eve::algo
{
template<typename T> auto force_type = eve_implementation_defined;
}
auto force_type
Definition traits.hpp:300
Template Parameters
TType every part converts to.

Converts every part of a zip to T before the computation, and the conversion is narrowing if T is narrower, where eve::algo::common_type and eve::algo::common_with_types reach their type by reduction.

eve::algo::inclusive_scan_to applies it with the type of its initial value: a scan over narrow input is accumulated in the wider type of that value:

std::vector<std::int8_t> v {100, 100, 100, 100};
std::vector<int> w (v.size());
// int init, so the running sum is read and written as int rather than wrapping at 127.
inclusive_scan_to(views::zip[force_type<int>](v, w), std::pair{eve::add, eve::zero}, 0);
constexpr auto add
tuple_callable computing the sum of its arguments.
Definition add.hpp:126
constexpr auto zero
Computes the constant 0.
Definition zero.hpp:78
constexpr auto zip
Given relaxed_iterors and relaxed ranges, zips them together (creates a single object)....
Definition zip.hpp:144
See also
eve::algo::views::zip, common_type, common_with_types