24namespace cuproj_test {
27template <
typename InVector,
typename OutVector>
28void convert_coordinates(InVector
const& in, OutVector& out)
30 using in_coord_type =
typename InVector::value_type;
31 using out_coord_type =
typename OutVector::value_type;
34 (std::is_same_v<out_coord_type, PJ_COORD> != std::is_same_v<in_coord_type, PJ_COORD>),
35 "Invalid coordinate vector conversion");
37 if constexpr (std::is_same_v<in_coord_type, PJ_COORD>) {
38 using T =
typename out_coord_type::value_type;
39 auto proj_coord_to_coordinate = [](
auto const& c) {
40 return out_coord_type{
static_cast<T
>(c.xy.x),
static_cast<T
>(c.xy.y)};
42 std::transform(in.begin(), in.end(), out.begin(), proj_coord_to_coordinate);
43 }
else if constexpr (std::is_same_v<out_coord_type, PJ_COORD>) {
44 auto coordinate_to_proj_coord = [](
auto const& c) {
return PJ_COORD{c.x, c.y, 0, 0}; };
45 std::transform(in.begin(), in.end(), out.begin(), coordinate_to_proj_coord);