Skip to content
Discussion options

You must be logged in to vote

I think I got it. The pre-allocated comes first, then any arguments comes afterwards:

      // Allow tuples instead of explicit LatLong objects.
      .def(
          "__init__",
          [](fastgpx::Bounds* obj, std::tuple<double, double> min_tuple,
             std::tuple<double, double> max_tuple) {
            fastgpx::LatLong min{std::get<0>(min_tuple), std::get<1>(min_tuple)};
            fastgpx::LatLong max{std::get<0>(max_tuple), std::get<1>(max_tuple)};
            return new (obj) fastgpx::Bounds(min, max);
          },
          nb::arg("min"), nb::arg("max"))

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@thomthom
Comment options

@wjakob
Comment options

@thomthom
Comment options

Answer selected by thomthom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants