Program Listing for File helpers.hpp

Return to documentation for file (include/nanoeigenpy/utils/helpers.hpp)

#pragma once

#include <nanobind/nanobind.h>

namespace nanoeigenpy {
namespace nb = nanobind;

template <typename T>
inline bool check_registration_alias(nb::module_& m) {
  if (nb::handle py_type = nb::type<T>(); py_type.is_valid()) {
    m.attr(py_type.attr("__name__")) = py_type;
    return true;
  }
  return false;
}

template <typename T>
[[deprecated("Use check_registration_alias<T>(m) instead.")]]
inline bool register_symbolic_link_to_registered_type(nb::module_& m) {
  return check_registration_alias<T>(m);
}

}  // namespace nanoeigenpy