2022-08-30 04:59:48 +00:00
|
|
|
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
|
|
|
|
template <typename ThisT>
|
|
|
|
auto &this_ = static_cast<ThisT &>(*this);
|
|
|
|
if (load_impl<ThisT>(temp, false)) {
|
|
|
|
ssize_t nd = 0;
|
|
|
|
auto trivial = broadcast(buffers, nd, shape);
|
|
|
|
auto ndim = (size_t) nd;
|
|
|
|
int nd;
|
|
|
|
ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
|
|
|
|
using op = op_impl<id, ot, Base, L_type, R_type>;
|
|
|
|
template <op_id id, op_type ot, typename L, typename R>
|
|
|
|
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
|
|
|
|
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
|
|
|
|
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
|
2024-07-02 17:45:33 +00:00
|
|
|
int valu;
|
|
|
|
explicit movable_int(int v) : valu{v} {}
|
|
|
|
movable_int(movable_int &&other) noexcept : valu(other.valu) { other.valu = 91; }
|
|
|
|
explicit indestructible_int(int v) : valu{v} {}
|
|
|
|
REQUIRE(hld.as_raw_ptr_unowned<zombie>()->valu == 19);
|
|
|
|
REQUIRE(othr.valu == 19);
|
|
|
|
REQUIRE(orig.valu == 91);
|
2024-07-02 20:40:16 +00:00
|
|
|
(m.pass_valu, "Valu", "pass_valu:Valu(_MvCtor)*_CpCtor"),
|
2024-07-05 19:35:32 +00:00
|
|
|
atyp_valu rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
|
|
|
|
assert m.atyp_valu().get_mtxt() == "Valu"
|
2024-07-07 19:51:50 +00:00
|
|
|
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,
|
2022-08-30 04:59:48 +00:00
|
|
|
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
|
|
|
|
struct IntStruct {
|
|
|
|
explicit IntStruct(int v) : value(v){};
|
|
|
|
~IntStruct() { value = -value; }
|
|
|
|
IntStruct(const IntStruct &) = default;
|
|
|
|
IntStruct &operator=(const IntStruct &) = default;
|
|
|
|
py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
|
|
|
|
py::implicitly_convertible<int, IntStruct>();
|
|
|
|
m.def("test", [](int expected, const IntStruct &in) {
|
|
|
|
[](int expected, const IntStruct &in) {
|