Can bindgen generate bindings to C++ operators

I need to write bindings for a POD C++ class.
This class has a few overloaded operators, and I want to generate bindings for them as well.
However, it seems like bindgen simply ignores them.
Are those not supported? I couldn't find anything in the documentation:

class Wrapped
{
public:
    explicit Wrapped(float x):
        data()
    {
        data = x;
    }

    Wrapped& operator/=(float scalar)
    {
        data /= scalar;
        return *this;
    }
private:
    float data;
};

Wrapped operator/(Wrapped v, float scalar)
{
    return Wrapped(v) /= scalar;
}

Generates:

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Wrapped {
    pub data: f32,
}
extern "C" {
    #[link_name = "\u{1}??0Wrapped@@QEAA@M@Z"]
    pub fn Wrapped_Wrapped(this: *mut Wrapped, x: f32);
}

Would be glad for any help!

Isn't this written literally in the first paragraph of the Bindgen docs?

You will have to manually call constructors, destructors, overloaded operators, etc yourself.

Well, by calling I believe it meant that I would need to call a generated function like Wrapped_div_1 and Wrapped_div_2, just like I need to do this for:

You will have to manually call constructors, destructors, overloaded operators, etc yourself

Which was generated, even in my example!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.