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

Detailed Description

Converts every part of a zip to a common type, extra types included.

Variables

template<typename ... Ts>
constexpr auto eve::algo::common_with_types = (common_with_types_key = eve::common_type<Ts...>{})

Variable Documentation

◆ common_with_types

template<typename ... Ts>
auto eve::algo::common_with_types = (common_with_types_key = eve::common_type<Ts...>{})
inlineconstexpr
Header file #include <eve/module/algo.hpp>
namespace eve::algo
{
template<typename... Ts> inline constexpr auto common_with_types = eve_implementation_defined;
}
constexpr auto common_with_types
Definition traits.hpp:349
Template Parameters
TsTypes taken into account besides the zip's own.

Converts every part of a zip to the common type of the parts and of Ts, as eve::common_type reduces them. The trait is for a computation that reads the parts in a type none of them is of.

std::vector<int> x {1, 3, -5, 10, 1};
std::vector<int> y {2, 1, 4, -10, 3};
std::vector<double> within {5.0, 6.0, 7.6, 10.1, 6.0};
// Both parts read as double, so the squared distance computes in double.
auto found = mismatch(x_y, within,
[](auto p, auto r)
{
auto [vx, vy] = p;
return vx * vx + vy * vy <= r * r;
});
constexpr auto mismatch
a SIMD version of std::mismatch
Definition mismatch.hpp:114
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, force_type