Explicit deletion of copy constructor and assignment in Pybind11

200 Views Asked by At

If you have a class with explicit deletion of the copy constructor and assignment operation as in the following example

        Foo(const Foo& other) = delete;
        Foo& operator=(const Foo& other) = delete;

how can you specify it in the Pybind11 wrapper for the class? Ultimately the purpose is to follow the intended use for the C++ class which enforces moving and forbids copying

        Foo(const Foo& other) = delete;
        Foo& operator=(const Foo& other) = delete;
        Foo(Foo&& other) = default;
        Foo& operator=(Foo&& other) = default; 
0

There are 0 best solutions below