MCPcopy Create free account
hub / github.com/citp/BlockSci / addAnyInit

Function addAnyInit

blockscipy/src/python_interface.cpp:58–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57template <typename T>
58void addAnyInit(py::class_<std::any> &cl) {
59 cl
60 .def(py::init([](T &val) -> std::any { return val; }))
61 .def(py::init([](ranges::optional<T> &val) -> std::any { return val; }))
62 .def(py::init([](Iterator<T> &val) -> std::any {
63 return val.rng;
64 }))
65 .def(py::init([](Range<T> &val) -> std::any {
66 return val.rng;
67 }))
68 ;
69
70 pybind11::implicitly_convertible<T, std::any>();
71 pybind11::implicitly_convertible<ranges::optional<T>, std::any>();
72 pybind11::implicitly_convertible<Iterator<T>, std::any>();
73 pybind11::implicitly_convertible<Range<T>, std::any>();
74}
75
76PYBIND11_MODULE(_blocksci, m) {
77 m.attr("__name__") = PYBIND11_STR_TYPE("blocksci");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected